177 references to Sys
System.Net.Sockets (177)
src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (3)
123
_error = Interop.
Sys
.ConvertErrorPlatformToPal(errno);
140
get { return _rawErrno == -1 ? (_rawErrno = Interop.
Sys
.ConvertErrorPalToPlatform(_error)) : _rawErrno; }
145
return Interop.
Sys
.StrError(RawErrno);
src\libraries\Common\src\System\Net\InteropIPAddressExtensions.Unix.cs (6)
11
public static unsafe Interop.
Sys
.IPAddress GetNativeIPAddress(this IPAddress ipAddress)
13
var nativeIPAddress = default(Interop.
Sys
.IPAddress);
15
ipAddress.TryWriteBytes(new Span<byte>(nativeIPAddress.Address, Interop.
Sys
.IPv6AddressBytes), out int bytesWritten);
16
Debug.Assert(bytesWritten == sizeof(uint) || bytesWritten == Interop.
Sys
.IPv6AddressBytes, $"Unexpected length: {bytesWritten}");
27
public static unsafe IPAddress GetIPAddress(this Interop.
Sys
.IPAddress nativeIPAddress)
37
new ReadOnlySpan<byte>(nativeIPAddress.Address, Interop.
Sys
.IPv6AddressBytes),
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (9)
26
Interop.Error err = Interop.
Sys
.GetSocketAddressSizes(&ipv4, &ipv6, &uds, &max);
66
err = Interop.
Sys
.GetAddressFamily(rawAddress, buffer.Length, (int*)&family);
81
err = Interop.
Sys
.SetAddressFamily(rawAddress, buffer.Length, (int)family);
94
err = Interop.
Sys
.GetPort(rawAddress, buffer.Length, &port);
106
err = Interop.
Sys
.SetPort(rawAddress, buffer.Length, port);
118
err = Interop.
Sys
.GetIPv4Address(rawAddress, buffer.Length, &ipAddress);
132
err = Interop.
Sys
.GetIPv6Address(rawAddress, buffer.Length, ipAddress, address.Length, &localScope);
144
err = Interop.
Sys
.SetIPv4Address(rawAddress, buffer.Length, address);
170
err = Interop.
Sys
.SetIPv6Address(rawAddress, buffer.Length, address, addressLength, scope);
src\libraries\Common\src\System\Net\SocketProtocolSupportPal.Unix.cs (2)
25
Interop.Error result = Interop.
Sys
.Socket((int)af, DgramSocketType, 0, &socket);
33
Interop.
Sys
.Close(socket);
System\Net\Sockets\SafeSocketHandle.Unix.cs (9)
199
int fdFlags = Interop.
Sys
.Fcntl.GetFD(handle);
208
Interop.Error err = Interop.
Sys
.GetSockOpt(handle, SocketOptionLevel.Socket, SocketOptionName.Type, (byte*)&type, &optLen);
215
Interop.
Sys
.Disconnect(handle);
219
Interop.
Sys
.Shutdown(handle, SocketShutdown.Both);
256
if (Interop.
Sys
.Fcntl.DangerousSetIsNonBlocking(handle, 0) == 0)
266
var linger = new Interop.
Sys
.LingerOption
272
errorCode = Interop.
Sys
.SetLingerOption(handle, &linger);
298
if (Interop.
Sys
.Close(handle) != 0)
300
errorCode = Interop.
Sys
.GetLastError();
System\Net\Sockets\Socket.Unix.cs (7)
68
Interop.Error e = Interop.
Sys
.GetSocketType(handle, out addressFamily, out socketType, out protocolType, out isListening);
77
if (Interop.
Sys
.FStat(handle, out Interop.
Sys
.FileStatus stat) == -1)
81
isSocket = (stat.Mode & Interop.
Sys
.FileTypes.S_IFSOCK) == Interop.
Sys
.FileTypes.S_IFSOCK;
91
Interop.Error e = Interop.
Sys
.GetSocketType(handle, out addressFamily, out socketType, out protocolType, out isListening);
110
int rv = Interop.
Sys
.Fcntl.GetIsNonBlocking(handle, out nonBlocking);
System\Net\Sockets\SocketAsyncContext.Unix.cs (23)
1361
if (Interop.
Sys
.Fcntl.SetIsNonBlocking(_socket, 1) != 0)
1363
throw new SocketException((int)SocketPal.GetSocketErrorForErrorCode(Interop.
Sys
.GetLastError()));
2198
public Interop.
Sys
.SocketEvents HandleSyncEventsSpeculatively(Interop.
Sys
.SocketEvents events)
2200
if ((events & Interop.
Sys
.SocketEvents.Error) != 0)
2204
events ^= Interop.
Sys
.SocketEvents.Error;
2205
events |= Interop.
Sys
.SocketEvents.Read | Interop.
Sys
.SocketEvents.Write;
2208
if ((events & Interop.
Sys
.SocketEvents.Read) != 0 &&
2212
events ^= Interop.
Sys
.SocketEvents.Read;
2215
if ((events & Interop.
Sys
.SocketEvents.Write) != 0 &&
2219
events ^= Interop.
Sys
.SocketEvents.Write;
2226
public void HandleEventsInline(Interop.
Sys
.SocketEvents events)
2228
if ((events & Interop.
Sys
.SocketEvents.Error) != 0)
2232
events ^= Interop.
Sys
.SocketEvents.Error;
2233
events |= Interop.
Sys
.SocketEvents.Read | Interop.
Sys
.SocketEvents.Write;
2236
if ((events & Interop.
Sys
.SocketEvents.Read) != 0)
2242
if ((events & Interop.
Sys
.SocketEvents.Write) != 0)
2250
public unsafe void HandleEvents(Interop.
Sys
.SocketEvents events)
2252
Debug.Assert((events & Interop.
Sys
.SocketEvents.Error) == 0);
2255
(events & Interop.
Sys
.SocketEvents.Read) != 0 ? _receiveQueue.ProcessSyncEventOrGetAsyncEvent(this) : null;
2257
(events & Interop.
Sys
.SocketEvents.Write) != 0 ? _sendQueue.ProcessSyncEventOrGetAsyncEvent(this) : null;
System\Net\Sockets\SocketAsyncEngine.Unix.cs (18)
80
/// <para>The index is used as the <see cref="Interop.
Sys
.SocketEvent.Data"/> to quickly map events to <see cref="SocketAsyncContext"/>s.</para>
87
private readonly Interop.
Sys
.SocketEvent* _buffer;
151
error = Interop.
Sys
.TryChangeSocketEventRegistration(_port, socketHandle, Interop.
Sys
.SocketEvents.None,
152
Interop.
Sys
.SocketEvents.Read | Interop.
Sys
.SocketEvents.Write, context.GlobalContextIndex);
187
err = Interop.
Sys
.CreateSocketEventPort(portPtr);
194
fixed (Interop.
Sys
.SocketEvent** bufferPtr = &_buffer)
196
err = Interop.
Sys
.CreateSocketEventBuffer(EventBufferCount, bufferPtr);
225
Interop.Error err = Interop.
Sys
.WaitForSocketEvents(_port, handler.Buffer, &numEvents);
340
Interop.
Sys
.FreeSocketEventBuffer(_buffer);
344
Interop.
Sys
.CloseSocketEventPort(_port);
355
public Interop.
Sys
.SocketEvent* Buffer { get; }
369
foreach (var socketEvent in new ReadOnlySpan<Interop.
Sys
.SocketEvent>(Buffer, numEvents))
386
Interop.
Sys
.SocketEvents events = context.HandleSyncEventsSpeculatively(socketEvent.Events);
388
if (events != Interop.
Sys
.SocketEvents.None)
404
public Interop.
Sys
.SocketEvents Events { get; }
406
public SocketIOEvent(SocketAsyncContext context, Interop.
Sys
.SocketEvents events)
System\Net\Sockets\SocketPal.Unix.cs (99)
19
public static readonly int MaximumAddressSize = Interop.
Sys
.GetMaximumAddressSize();
29
Interop.
Sys
.PlatformSupportsDualModeIPv4PacketInfo() != 0;
43
private static unsafe IPPacketInformation GetIPPacketInformation(Interop.
Sys
.MessageHeader* messageHeader, bool isIPv4, bool isIPv6)
50
Interop.
Sys
.IPPacketInformation nativePacketInfo = default;
51
if (!Interop.
Sys
.TryGetIPPacketInformation(messageHeader, isIPv4, &nativePacketInfo))
65
Interop.Error error = Interop.
Sys
.Socket((int)addressFamily, (int)socketType, (int)protocolType, &fd);
78
error = Interop.
Sys
.SetSockOpt(fd, SocketOptionLevel.IPv6, SocketOptionName.IPv6Only, (byte*)&on, sizeof(int));
81
Interop.
Sys
.Close(fd);
113
received = Interop.
Sys
.Read(handle, b, buffer.Length);
114
errno = received != -1 ? Interop.Error.SUCCESS : Interop.
Sys
.GetLastError();
128
errno = Interop.
Sys
.Receive(
153
var iov = new Interop.
Sys
.IOVector {
160
var messageHeader = new Interop.
Sys
.MessageHeader {
167
errno = Interop.
Sys
.ReceiveMessage(
193
sent = Interop.
Sys
.Write(handle, b + offset, count);
196
errno = Interop.
Sys
.GetLastError();
223
errno = Interop.
Sys
.Send(
251
var iov = new Interop.
Sys
.IOVector
257
var messageHeader = new Interop.
Sys
.MessageHeader
266
errno = Interop.
Sys
.SendMessage(
300
Span<Interop.
Sys
.IOVector> iovecs = allocOnStack ? stackalloc Interop.
Sys
.IOVector[IovStackThreshold] : new Interop.
Sys
.IOVector[maxBuffers];
319
fixed (Interop.
Sys
.IOVector* iov = iovecs)
321
var messageHeader = new Interop.
Sys
.MessageHeader {
329
errno = Interop.
Sys
.SendMessage(
374
errno = Interop.
Sys
.SendFile(socket, fileHandle, offset, count, out bytesSent);
396
errno = Interop.
Sys
.GetBytesAvailable(socket, &available);
412
Span<Interop.
Sys
.IOVector> iovecs = allocOnStack ? stackalloc Interop.
Sys
.IOVector[IovStackThreshold] : new Interop.
Sys
.IOVector[maxBuffers];
445
fixed (Interop.
Sys
.IOVector* iov = iovecs)
447
var messageHeader = new Interop.
Sys
.MessageHeader {
454
errno = Interop.
Sys
.ReceiveMessage(
487
int cmsgBufferLen = Interop.
Sys
.GetControlMessageBufferSize(Convert.ToInt32(isIPv4), Convert.ToInt32(isIPv6));
490
Interop.
Sys
.MessageHeader messageHeader;
496
var iov = new Interop.
Sys
.IOVector {
503
messageHeader = new Interop.
Sys
.MessageHeader {
512
errno = Interop.
Sys
.ReceiveMessage(
554
Span<Interop.
Sys
.IOVector> iovecs = allocOnStack ? stackalloc Interop.
Sys
.IOVector[IovStackThreshold] : new Interop.
Sys
.IOVector[buffersCount];
572
fixed (Interop.
Sys
.IOVector* iov = iovecs)
574
int cmsgBufferLen = Interop.
Sys
.GetControlMessageBufferSize(Convert.ToInt32(isIPv4), Convert.ToInt32(isIPv6));
577
var messageHeader = new Interop.
Sys
.MessageHeader
588
errno = Interop.
Sys
.ReceiveMessage(
635
errno = Interop.
Sys
.Accept(socket, rawSocketAddress, &sockAddrLen, &fd);
688
err = Interop.
Sys
.Connectx(socket, rawSocketAddress, socketAddress.Length, data, data.Length, tfo ? 1 : 0, &sentBytes);
693
err = Interop.
Sys
.Connect(socket, rawSocketAddress, socketAddress.Length);
725
err = Interop.
Sys
.Poll(socket, Interop.PollEvents.POLLOUT, timeout: 0, out outEvents);
734
err = Interop.
Sys
.GetSocketErrorOption(socket, &socketError);
1085
Interop.Error err = Interop.
Sys
.GetSockName(handle, buffer, nameLen);
1092
Interop.Error err = Interop.
Sys
.GetBytesAvailable(handle, &value);
1101
Interop.Error err = Interop.
Sys
.GetAtOutOfBandMark(handle, &value);
1113
err = Interop.
Sys
.GetPeerName(handle, rawBuffer, &addrLen);
1122
Interop.Error err = Interop.
Sys
.Bind(handle, socketProtocolType, buffer);
1129
Interop.Error err = Interop.
Sys
.Listen(handle, backlog);
1440
err = Interop.
Sys
.SetReceiveTimeout(handle, optionValue);
1446
err = Interop.
Sys
.SetSendTimeout(handle, optionValue);
1459
var opt = new Interop.
Sys
.IPv4MulticastOption
1466
err = Interop.
Sys
.SetIPv4MulticastOption(handle, Interop.
Sys
.MulticastOption.MULTICAST_IF, &opt);
1472
err = Interop.
Sys
.SetSockOpt(handle, optionLevel, optionName, (byte*)&optionValue, sizeof(int));
1506
Interop.Error err = Interop.
Sys
.SetSockOpt(handle, optionLevel, optionName, pinnedValue, optionValue != null ? optionValue.Length : 0);
1515
Interop.Error err = Interop.
Sys
.SetRawSockOpt(handle, optionLevel, optionName, optionValuePtr, optionValue.Length);
1536
Interop.
Sys
.MulticastOption optName = optionName == SocketOptionName.AddMembership ?
1537
Interop.
Sys
.MulticastOption.MULTICAST_ADD :
1538
Interop.
Sys
.MulticastOption.MULTICAST_DROP;
1543
var opt = new Interop.
Sys
.IPv4MulticastOption
1551
Interop.Error err = Interop.
Sys
.SetIPv4MulticastOption(handle, optName, &opt);
1559
Interop.
Sys
.MulticastOption optName = optionName == SocketOptionName.AddMembership ?
1560
Interop.
Sys
.MulticastOption.MULTICAST_ADD :
1561
Interop.
Sys
.MulticastOption.MULTICAST_DROP;
1563
var opt = new Interop.
Sys
.IPv6MulticastOption {
1568
Interop.Error err = Interop.
Sys
.SetIPv6MulticastOption(handle, optName, &opt);
1574
var opt = new Interop.
Sys
.LingerOption {
1579
Interop.Error err = Interop.
Sys
.SetLingerOption(handle, &opt);
1619
Interop.Error getErrorError = Interop.
Sys
.GetSocketErrorOption(handle, &socketError);
1626
Interop.Error err = Interop.
Sys
.GetSockOpt(handle, optionLevel, optionName, (byte*)&value, &optLen);
1651
err = Interop.
Sys
.GetSockOpt(handle, optionLevel, optionName, null, &optLen);
1671
err = Interop.
Sys
.GetSockOpt(handle, optionLevel, optionName, pinnedValue, &optLen);
1691
Interop.Error err = Interop.
Sys
.GetRawSockOpt(handle, optionLevel, optionName, pinnedValue, &optLen);
1707
Interop.
Sys
.MulticastOption optName = optionName == SocketOptionName.AddMembership ?
1708
Interop.
Sys
.MulticastOption.MULTICAST_ADD :
1709
Interop.
Sys
.MulticastOption.MULTICAST_DROP;
1711
Interop.
Sys
.IPv4MulticastOption opt = default;
1712
Interop.Error err = Interop.
Sys
.GetIPv4MulticastOption(handle, optName, &opt);
1732
Interop.
Sys
.MulticastOption optName = optionName == SocketOptionName.AddMembership ?
1733
Interop.
Sys
.MulticastOption.MULTICAST_ADD :
1734
Interop.
Sys
.MulticastOption.MULTICAST_DROP;
1736
Interop.
Sys
.IPv6MulticastOption opt = default;
1737
Interop.Error err = Interop.
Sys
.GetIPv6MulticastOption(handle, optName, &opt);
1750
Interop.
Sys
.LingerOption opt = default;
1751
Interop.Error err = Interop.
Sys
.GetLingerOption(handle, &opt);
1775
Interop.Error err = Interop.
Sys
.Poll(handle, inEvent, milliseconds, out outEvents);
1851
Interop.Error err = Interop.
Sys
.Select(readFDs, readFDs.Length, writeFDs, writeFDs.Length, errorFDs, errorFDs.Length, microseconds, maxFd, out triggered);
1956
Interop.Error err = Interop.
Sys
.Poll(events, (uint)eventsLength, milliseconds, &triggered);
2051
Interop.Error err = Interop.
Sys
.Shutdown(handle, how);
2177
Interop.Error err = Interop.
Sys
.Poll(handle, Interop.PollEvents.POLLOUT, timeout: 0, out Interop.PollEvents outEvents);
System\Net\Sockets\UnixDomainSocketEndPoint.Unix.cs (1)
24
Interop.
Sys
.GetDomainSocketSizes(pathOffset, pathLength, addressSize);