Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Poll()

static unsafe SocketError System.Net.Sockets.SocketPal.Poll ( SafeSocketHandle handle,
int microseconds,
SelectMode mode,
out bool status )
inlinestatic

Definition at line 671 of file SocketPal.cs.

672 {
673 bool success = false;
674 try
675 {
676 handle.DangerousAddRef(ref success);
677 IntPtr intPtr = handle.DangerousGetHandle();
679 {
680 (IntPtr)1,
681 intPtr
682 };
683 global::Interop.Winsock.TimeValue socketTime = default(global::Interop.Winsock.TimeValue);
684 int num;
685 if (microseconds != -1)
686 {
688 num = global::Interop.Winsock.select(0, (mode == SelectMode.SelectRead) ? ptr : null, (mode == SelectMode.SelectWrite) ? ptr : null, (mode == SelectMode.SelectError) ? ptr : null, ref socketTime);
689 }
690 else
691 {
692 num = global::Interop.Winsock.select(0, (mode == SelectMode.SelectRead) ? ptr : null, (mode == SelectMode.SelectWrite) ? ptr : null, (mode == SelectMode.SelectError) ? ptr : null, IntPtr.Zero);
693 }
694 if (num == -1)
695 {
696 status = false;
697 return GetLastSocketError();
698 }
699 status = (int)(*ptr) != 0 && ptr[1] == intPtr;
700 return SocketError.Success;
701 }
702 finally
703 {
704 if (success)
705 {
706 handle.DangerousRelease();
707 }
708 }
709 }
static void MicrosecondsToTimeValue(long microseconds, ref global::Interop.Winsock.TimeValue socketTime)
Definition SocketPal.cs:16
static SocketError GetLastSocketError()
Definition SocketPal.cs:22

References System.Net.Sockets.SocketPal.GetLastSocketError(), System.handle, System.Net.Sockets.SocketPal.MicrosecondsToTimeValue(), and System.IntPtr.Zero.

Referenced by System.Net.Sockets.Socket.Poll().