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

◆ SetSocketOption() [4/5]

void System.Net.Sockets.Socket.SetSocketOption ( SocketOptionLevel optionLevel,
SocketOptionName optionName,
int optionValue,
bool silent )
inlinepackage

Definition at line 3471 of file Socket.cs.

3472 {
3473 if (silent && (Disposed || _handle.IsInvalid))
3474 {
3475 if (System.Net.NetEventSource.Log.IsEnabled())
3476 {
3477 System.Net.NetEventSource.Info(this, "skipping the call", "SetSocketOption");
3478 }
3479 return;
3480 }
3481 SocketError socketError = SocketError.Success;
3482 try
3483 {
3484 socketError = SocketPal.SetSockOpt(_handle, optionLevel, optionName, optionValue);
3485 if (System.Net.NetEventSource.Log.IsEnabled())
3486 {
3487 System.Net.NetEventSource.Info(this, $"SetSockOpt returns errorCode:{socketError}", "SetSocketOption");
3488 }
3489 }
3490 catch
3491 {
3492 if (silent && _handle.IsInvalid)
3493 {
3494 return;
3495 }
3496 throw;
3497 }
3498 if (optionName == SocketOptionName.PacketInformation && optionValue == 0 && socketError == SocketError.Success)
3499 {
3501 }
3502 if (!silent && socketError != 0)
3503 {
3505 }
3506 }
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
SafeSocketHandle _handle
Definition Socket.cs:533
void UpdateStatusAfterSocketErrorAndThrowException(SocketError error, [CallerMemberName] string callerName=null)
Definition Socket.cs:3715

References System.Net.Sockets.Socket._handle, System.Net.Sockets.Socket._receivingPacketInformation, System.Net.Sockets.Socket.Disposed, System.Net.NetEventSource.Info(), System.Net.Sockets.SafeSocketHandle.IsInvalid, System.Net.NetEventSource.Log, System.Net.Sockets.SocketPal.SetSockOpt(), and System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException().