6 instantiations of SafeSocketHandle
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (1)
SocketTransportOptions.cs (1)
136
new
SafeSocketHandle
((IntPtr)fileHandle.FileHandle, ownsHandle: false)
System.IO.Pipes (1)
Microsoft\Win32\SafeHandles\SafePipeHandle.Unix.cs (1)
84
socket = SetPipeSocketInterlocked(new Socket(new
SafeSocketHandle
(handle, ownsHandle)), ownsHandle);
System.Net.NetworkInformation (1)
System\Net\NetworkInformation\NetworkAddressChange.Unix.cs (1)
155
var sh = new
SafeSocketHandle
();
System.Net.Sockets (3)
System\Net\Sockets\SocketPal.Unix.cs (3)
61
socket = new
SafeSocketHandle
();
1135
socket = new
SafeSocketHandle
();
2169
var res = new
SafeSocketHandle
(fileDescriptor, ownsHandle: true);
104 references to SafeSocketHandle
System.IO.Pipes (1)
Microsoft\Win32\SafeHandles\SafePipeHandle.Unix.cs (1)
121
SafeSocketHandle
socketHandle = _pipeSocket.SafeHandle;
System.Net.NetworkInformation (1)
System\Net\NetworkInformation\NetworkAddressChange.Unix.cs (1)
155
var
sh = new SafeSocketHandle();
System.Net.Sockets (102)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.GetSocketType.cs (1)
12
internal static partial Error GetSocketType(
SafeSocketHandle
socket, out AddressFamily addressFamily, out SocketType socketType, out ProtocolType protocolType, [MarshalAs(UnmanagedType.Bool)] out bool isListening);
System\Net\Sockets\SafeSocketHandle.Unix.cs (1)
94
internal void TransferTrackedState(
SafeSocketHandle
target)
System\Net\Sockets\Socket.cs (12)
28
private
SafeSocketHandle
_handle;
109
/// This method populates the <see cref="Socket"/> instance with data gathered from the supplied <see cref="
SafeSocketHandle
"/>.
114
public Socket(
SafeSocketHandle
handle) :
119
private unsafe Socket(
SafeSocketHandle
handle, bool loadPropertiesFromHandle)
237
private static
SafeSocketHandle
ValidateHandle(
SafeSocketHandle
handle)
393
public
SafeSocketHandle
SafeHandle
402
internal
SafeSocketHandle
InternalSafeHandle => _handle; // returns _handle without calling SetExposed.
1056
SafeSocketHandle
acceptedSocketHandle;
2852
SafeSocketHandle
? acceptHandle;
3404
SafeSocketHandle
? handle = _handle;
3775
internal Socket CreateAcceptSocket(
SafeSocketHandle
fd, EndPoint? remoteEP)
System\Net\Sockets\Socket.Unix.cs (5)
64
SafeSocketHandle
handle, out AddressFamily addressFamily, out SocketType socketType, out ProtocolType protocolType, out bool blocking, out bool isListening, out bool isSocket)
138
Span<int> optionValues = stackalloc int[
SafeSocketHandle
.TrackableOptionCount];
142
SafeSocketHandle
oldHandle = _handle;
143
SocketError errorCode = SocketPal.CreateSocket(_addressFamily, _socketType, _protocolType, out
SafeSocketHandle
newHandle);
171
private Socket? GetOrCreateAcceptSocket(Socket? acceptSocket, bool checkDisconnected, string propertyName, out
SafeSocketHandle
? handle)
System\Net\Sockets\SocketAsyncContext.Unix.cs (2)
1259
internal readonly
SafeSocketHandle
_socket;
1270
public SocketAsyncContext(
SafeSocketHandle
socket)
System\Net\Sockets\SocketAsyncEventArgs.Unix.cs (11)
46
internal unsafe SocketError DoOperationAccept(Socket _ /*socket*/,
SafeSocketHandle
handle,
SafeSocketHandle
? acceptHandle, CancellationToken cancellationToken)
74
internal unsafe SocketError DoOperationConnectEx(Socket _ /*socket*/,
SafeSocketHandle
handle)
84
internal unsafe SocketError DoOperationConnect(
SafeSocketHandle
handle)
94
internal SocketError DoOperationDisconnect(Socket socket,
SafeSocketHandle
handle, CancellationToken _ /*cancellationToken*/)
117
internal unsafe SocketError DoOperationReceive(
SafeSocketHandle
handle, CancellationToken cancellationToken)
153
internal unsafe SocketError DoOperationReceiveFrom(
SafeSocketHandle
handle, CancellationToken cancellationToken)
196
internal unsafe SocketError DoOperationReceiveMessageFrom(Socket socket,
SafeSocketHandle
handle, CancellationToken cancellationToken)
219
internal unsafe SocketError DoOperationSend(
SafeSocketHandle
handle, CancellationToken cancellationToken)
244
internal SocketError DoOperationSendPackets(Socket socket,
SafeSocketHandle
_1 /*handle*/, CancellationToken cancellationToken)
303
internal SocketError DoOperationSendTo(
SafeSocketHandle
handle, CancellationToken cancellationToken)
System\Net\Sockets\SocketPal.Unix.cs (70)
59
public static unsafe SocketError CreateSocket(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType, out
SafeSocketHandle
socket)
105
private static unsafe int SysRead(
SafeSocketHandle
handle, Span<byte> buffer, out Interop.Error errno)
120
private static unsafe int SysReceive(
SafeSocketHandle
socket, SocketFlags flags, Span<byte> buffer, out Interop.Error errno)
144
private static unsafe int SysReceive(
SafeSocketHandle
socket, SocketFlags flags, Span<byte> buffer, Span<byte> socketAddress, out int socketAddressLen, out SocketFlags receivedFlags, out Interop.Error errno)
185
private static unsafe int SysWrite(
SafeSocketHandle
handle, ReadOnlySpan<byte> buffer, ref int offset, ref int count, out Interop.Error errno)
214
private static unsafe int SysSend(
SafeSocketHandle
socket, SocketFlags flags, ReadOnlySpan<byte> buffer, ref int offset, ref int count, out Interop.Error errno)
241
private static unsafe int SysSend(
SafeSocketHandle
socket, SocketFlags flags, ReadOnlySpan<byte> buffer, ref int offset, ref int count, ReadOnlySpan<byte> socketAddress, out Interop.Error errno)
285
private static unsafe int SysSend(
SafeSocketHandle
socket, SocketFlags flags, IList<ArraySegment<byte>> buffers, ref int bufferIndex, ref int offset, ReadOnlySpan<byte> socketAddress, out Interop.Error errno)
371
private static unsafe long SendFile(
SafeSocketHandle
socket, SafeFileHandle fileHandle, ref long offset, ref long count, out Interop.Error errno)
380
private static unsafe int SysReceive(
SafeSocketHandle
socket, SocketFlags flags, IList<ArraySegment<byte>> buffers, Span<byte> socketAddress, out int socketAddressLen, out SocketFlags receivedFlags, out Interop.Error errno)
483
private static unsafe int SysReceiveMessageFrom(
SafeSocketHandle
socket, SocketFlags flags, Span<byte> buffer, Span<byte> socketAddress, out int socketAddressLen, bool isIPv4, bool isIPv6, out SocketFlags receivedFlags, out IPPacketInformation ipPacketInformation, out Interop.Error errno)
539
SafeSocketHandle
socket, SocketFlags flags, IList<ArraySegment<byte>> buffers,
626
public static unsafe bool TryCompleteAccept(
SafeSocketHandle
socket, Memory<byte> socketAddress, out int socketAddressLen, out IntPtr acceptedFd, out SocketError errorCode)
669
public static unsafe bool TryStartConnect(
SafeSocketHandle
socket, Memory<byte> socketAddress, out SocketError errorCode) => TryStartConnect(socket, socketAddress, out errorCode, Span<byte>.Empty, false, out int _ );
671
public static unsafe bool TryStartConnect(
SafeSocketHandle
socket, Memory<byte> socketAddress, out SocketError errorCode, Span<byte> data, bool tfo, out int sent)
713
public static unsafe bool TryCompleteConnect(
SafeSocketHandle
socket, out SocketError errorCode)
767
public static bool TryCompleteReceiveFrom(
SafeSocketHandle
socket, Span<byte> buffer, SocketFlags flags, Span<byte> socketAddress, out int socketAddressLen, out int bytesReceived, out SocketFlags receivedFlags, out SocketError errorCode) =>
770
public static bool TryCompleteReceiveFrom(
SafeSocketHandle
socket, IList<ArraySegment<byte>> buffers, SocketFlags flags, Span<byte> socketAddress, out int socketAddressLen, out int bytesReceived, out SocketFlags receivedFlags, out SocketError errorCode) =>
773
public static unsafe bool TryCompleteReceive(
SafeSocketHandle
socket, Span<byte> buffer, SocketFlags flags, out int bytesReceived, out SocketError errorCode)
832
public static unsafe bool TryCompleteReceiveFrom(
SafeSocketHandle
socket, Span<byte> buffer, IList<ArraySegment<byte>>? buffers, SocketFlags flags, Span<byte> socketAddress, out int receivedSocketAddressLength, out int bytesReceived, out SocketFlags receivedFlags, out SocketError errorCode)
903
public static unsafe bool TryCompleteReceiveMessageFrom(
SafeSocketHandle
socket, Span<byte> buffer, IList<ArraySegment<byte>>? buffers, SocketFlags flags, Memory<byte> socketAddress, out int receivedSocketAddressLength, bool isIPv4, bool isIPv6, out int bytesReceived, out SocketFlags receivedFlags, out IPPacketInformation ipPacketInformation, out SocketError errorCode)
949
public static bool TryCompleteSendTo(
SafeSocketHandle
socket, Span<byte> buffer, ref int offset, ref int count, SocketFlags flags, ReadOnlySpan<byte> socketAddress, ref int bytesSent, out SocketError errorCode)
955
public static bool TryCompleteSendTo(
SafeSocketHandle
socket, ReadOnlySpan<byte> buffer, SocketFlags flags, ReadOnlySpan<byte> socketAddress, ref int bytesSent, out SocketError errorCode)
961
public static bool TryCompleteSendTo(
SafeSocketHandle
socket, IList<ArraySegment<byte>> buffers, ref int bufferIndex, ref int offset, SocketFlags flags, ReadOnlySpan<byte> socketAddress, ref int bytesSent, out SocketError errorCode)
967
public static bool TryCompleteSendTo(
SafeSocketHandle
socket, ReadOnlySpan<byte> buffer, IList<ArraySegment<byte>>? buffers, ref int bufferIndex, ref int offset, ref int count, SocketFlags flags, ReadOnlySpan<byte> socketAddress, ref int bytesSent, out SocketError errorCode)
1036
public static bool TryCompleteSendFile(
SafeSocketHandle
socket, SafeFileHandle handle, ref long offset, ref long count, ref long bytesSent, out SocketError errorCode)
1074
public static SocketError SetBlocking(
SafeSocketHandle
handle, bool shouldBlock, out bool willBlock)
1083
public static unsafe SocketError GetSockName(
SafeSocketHandle
handle, byte* buffer, int* nameLen)
1089
public static unsafe SocketError GetAvailable(
SafeSocketHandle
handle, out int available)
1098
public static unsafe SocketError GetAtOutOfBandMark(
SafeSocketHandle
handle, out int atOutOfBandMark)
1107
public static unsafe SocketError GetPeerName(
SafeSocketHandle
handle, Span<byte> buffer, ref int nameLen)
1120
public static unsafe SocketError Bind(
SafeSocketHandle
handle, ProtocolType socketProtocolType, ReadOnlySpan<byte> buffer)
1127
public static SocketError Listen(
SafeSocketHandle
handle, int backlog)
1133
public static SocketError Accept(
SafeSocketHandle
listenSocket, Memory<byte> socketAddress, out int socketAddressLen, out
SafeSocketHandle
socket)
1158
public static SocketError Connect(
SafeSocketHandle
handle, Memory<byte> socketAddress)
1178
public static SocketError Send(
SafeSocketHandle
handle, IList<ArraySegment<byte>> buffers, SocketFlags socketFlags, out int bytesTransferred)
1194
public static SocketError Send(
SafeSocketHandle
handle, byte[] buffer, int offset, int count, SocketFlags socketFlags, out int bytesTransferred)
1207
public static SocketError Send(
SafeSocketHandle
handle, ReadOnlySpan<byte> buffer, SocketFlags socketFlags, out int bytesTransferred)
1220
public static SocketError SendFile(
SafeSocketHandle
handle, SafeFileHandle fileHandle)
1236
public static SocketError SendTo(
SafeSocketHandle
handle, byte[] buffer, int offset, int count, SocketFlags socketFlags, Memory<byte> socketAddress, out int bytesTransferred)
1249
public static SocketError SendTo(
SafeSocketHandle
handle, ReadOnlySpan<byte> buffer, SocketFlags socketFlags, Memory<byte> socketAddress, out int bytesTransferred)
1262
public static SocketError Receive(
SafeSocketHandle
handle, IList<ArraySegment<byte>> buffers, SocketFlags socketFlags, out int bytesTransferred)
1280
public static SocketError Receive(
SafeSocketHandle
handle, byte[] buffer, int offset, int count, SocketFlags socketFlags, out int bytesTransferred)
1292
public static SocketError Receive(
SafeSocketHandle
handle, Span<byte> buffer, SocketFlags socketFlags, out int bytesTransferred)
1304
public static SocketError ReceiveMessageFrom(Socket socket,
SafeSocketHandle
handle, byte[] buffer, int offset, int count, ref SocketFlags socketFlags, SocketAddress socketAddress, out SocketAddress receiveAddress, out IPPacketInformation ipPacketInformation, out int bytesTransferred)
1330
public static SocketError ReceiveMessageFrom(Socket socket,
SafeSocketHandle
handle, Span<byte> buffer, ref SocketFlags socketFlags, SocketAddress socketAddress, out SocketAddress receiveAddress, out IPPacketInformation ipPacketInformation, out int bytesTransferred)
1355
public static SocketError ReceiveFrom(
SafeSocketHandle
handle, byte[] buffer, int offset, int count, SocketFlags socketFlags, Memory<byte> socketAddress, out int socketAddressLen, out int bytesTransferred)
1367
public static SocketError ReceiveFrom(
SafeSocketHandle
handle, Span<byte> buffer, SocketFlags socketFlags, Memory<byte> socketAddress, out int socketAddressLen, out int bytesTransferred)
1379
public static SocketError WindowsIoctl(
SafeSocketHandle
handle, int ioControlCode, byte[]? _ /*optionInValue*/, byte[]? optionOutValue, out int optionLength)
1421
private static SocketError GetErrorAndTrackSetting(
SafeSocketHandle
handle, SocketOptionLevel optionLevel, SocketOptionName optionName, Interop.Error err)
1431
public static unsafe SocketError SetSockOpt(
SafeSocketHandle
handle, SocketOptionLevel optionLevel, SocketOptionName optionName, int optionValue)
1502
public static unsafe SocketError SetSockOpt(
SafeSocketHandle
handle, SocketOptionLevel optionLevel, SocketOptionName optionName, byte[] optionValue)
1511
public static unsafe SocketError SetRawSockOpt(
SafeSocketHandle
handle, int optionLevel, int optionName, ReadOnlySpan<byte> optionValue)
1532
public static unsafe SocketError SetMulticastOption(
SafeSocketHandle
handle, SocketOptionName optionName, MulticastOption optionValue)
1555
public static unsafe SocketError SetIPv6MulticastOption(
SafeSocketHandle
handle, SocketOptionName optionName, IPv6MulticastOption optionValue)
1572
public static unsafe SocketError SetLingerOption(
SafeSocketHandle
handle, LingerOption optionValue)
1600
public static unsafe SocketError GetSockOpt(
SafeSocketHandle
handle, SocketOptionLevel optionLevel, SocketOptionName optionName, out int optionValue)
1643
public static unsafe SocketError GetSockOpt(
SafeSocketHandle
handle, SocketOptionLevel optionLevel, SocketOptionName optionName, byte[] optionValue, ref int optionLength)
1684
public static unsafe SocketError GetRawSockOpt(
SafeSocketHandle
handle, int optionLevel, int optionName, Span<byte> optionValue, ref int optionLength)
1703
public static unsafe SocketError GetMulticastOption(
SafeSocketHandle
handle, SocketOptionName optionName, out MulticastOption? optionValue)
1728
public static unsafe SocketError GetIPv6MulticastOption(
SafeSocketHandle
handle, SocketOptionName optionName, out IPv6MulticastOption? optionValue)
1748
public static unsafe SocketError GetLingerOption(
SafeSocketHandle
handle, out LingerOption? optionValue)
1762
public static unsafe SocketError Poll(
SafeSocketHandle
handle, int microseconds, SelectMode mode, out bool status)
2049
public static SocketError Shutdown(
SafeSocketHandle
handle, bool isConnected, bool isDisconnected, SocketShutdown how)
2070
private static SocketError SendFileAsync(
SafeSocketHandle
handle, SafeFileHandle fileHandle, long offset, long count, CancellationToken cancellationToken, Action<long, SocketError> callback)
2157
internal static SocketError Disconnect(Socket socket,
SafeSocketHandle
handle, bool reuseSocket)
2167
internal static unsafe
SafeSocketHandle
CreateSocket(IntPtr fileDescriptor)
2169
var
res = new SafeSocketHandle(fileDescriptor, ownsHandle: true);
2175
internal static bool HasNonBlockingConnectCompleted(
SafeSocketHandle
handle, out bool success)