174 references to Sys
System.Net.Sockets (174)
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);
251
if (Interop.
Sys
.Fcntl.DangerousSetIsNonBlocking(handle, 0) == 0)
261
var linger = new Interop.
Sys
.LingerOption
267
errorCode = Interop.
Sys
.SetLingerOption(handle, &linger);
293
if (Interop.
Sys
.Close(handle) != 0)
295
errorCode = Interop.
Sys
.GetLastError();
System\Net\Sockets\Socket.Unix.cs (6)
64
if (Interop.
Sys
.FStat(handle, out Interop.
Sys
.FileStatus stat) == -1)
68
isSocket = (stat.Mode & Interop.
Sys
.FileTypes.S_IFSOCK) == Interop.
Sys
.FileTypes.S_IFSOCK;
78
Interop.Error e = Interop.
Sys
.GetSocketType(handle, out addressFamily, out socketType, out protocolType, out isListening);
97
int rv = Interop.
Sys
.Fcntl.GetIsNonBlocking(handle, out nonBlocking);
System\Net\Sockets\SocketAsyncContext.Unix.cs (23)
1351
if (Interop.
Sys
.Fcntl.SetIsNonBlocking(_socket, 1) != 0)
1353
throw new SocketException((int)SocketPal.GetSocketErrorForErrorCode(Interop.
Sys
.GetLastError()));
2167
public Interop.
Sys
.SocketEvents HandleSyncEventsSpeculatively(Interop.
Sys
.SocketEvents events)
2169
if ((events & Interop.
Sys
.SocketEvents.Error) != 0)
2173
events ^= Interop.
Sys
.SocketEvents.Error;
2174
events |= Interop.
Sys
.SocketEvents.Read | Interop.
Sys
.SocketEvents.Write;
2177
if ((events & Interop.
Sys
.SocketEvents.Read) != 0 &&
2181
events ^= Interop.
Sys
.SocketEvents.Read;
2184
if ((events & Interop.
Sys
.SocketEvents.Write) != 0 &&
2188
events ^= Interop.
Sys
.SocketEvents.Write;
2195
public void HandleEventsInline(Interop.
Sys
.SocketEvents events)
2197
if ((events & Interop.
Sys
.SocketEvents.Error) != 0)
2201
events ^= Interop.
Sys
.SocketEvents.Error;
2202
events |= Interop.
Sys
.SocketEvents.Read | Interop.
Sys
.SocketEvents.Write;
2205
if ((events & Interop.
Sys
.SocketEvents.Read) != 0)
2211
if ((events & Interop.
Sys
.SocketEvents.Write) != 0)
2219
public unsafe void HandleEvents(Interop.
Sys
.SocketEvents events)
2221
Debug.Assert((events & Interop.
Sys
.SocketEvents.Error) == 0);
2224
(events & Interop.
Sys
.SocketEvents.Read) != 0 ? _receiveQueue.ProcessSyncEventOrGetAsyncEvent(this) : null;
2226
(events & Interop.
Sys
.SocketEvents.Write) != 0 ? _sendQueue.ProcessSyncEventOrGetAsyncEvent(this) : null;
System\Net\Sockets\SocketAsyncEngine.Unix.cs (17)
78
private readonly Interop.
Sys
.SocketEvent* _buffer;
130
error = Interop.
Sys
.TryChangeSocketEventRegistration(_port, socketHandle, Interop.
Sys
.SocketEvents.None,
131
Interop.
Sys
.SocketEvents.Read | Interop.
Sys
.SocketEvents.Write, socketHandle);
157
err = Interop.
Sys
.CreateSocketEventPort(portPtr);
164
fixed (Interop.
Sys
.SocketEvent** bufferPtr = &_buffer)
166
err = Interop.
Sys
.CreateSocketEventBuffer(EventBufferCount, bufferPtr);
195
Interop.Error err = Interop.
Sys
.WaitForSocketEvents(_port, handler.Buffer, &numEvents);
310
Interop.
Sys
.FreeSocketEventBuffer(_buffer);
314
Interop.
Sys
.CloseSocketEventPort(_port);
325
public Interop.
Sys
.SocketEvent* Buffer { get; }
341
foreach (var socketEvent in new ReadOnlySpan<Interop.
Sys
.SocketEvent>(Buffer, numEvents))
353
Interop.
Sys
.SocketEvents events = context.HandleSyncEventsSpeculatively(socketEvent.Events);
355
if (events != Interop.
Sys
.SocketEvents.None)
383
public Interop.
Sys
.SocketEvents Events { get; }
385
public SocketIOEvent(SocketAsyncContext context, Interop.
Sys
.SocketEvents events)
System\Net\Sockets\SocketPal.Unix.cs (98)
19
public static readonly int MaximumAddressSize = Interop.
Sys
.GetMaximumAddressSize();
27
Interop.
Sys
.PlatformSupportsDualModeIPv4PacketInfo() != 0;
41
private static unsafe IPPacketInformation GetIPPacketInformation(Interop.
Sys
.MessageHeader* messageHeader, bool isIPv4, bool isIPv6)
48
Interop.
Sys
.IPPacketInformation nativePacketInfo = default;
49
if (!Interop.
Sys
.TryGetIPPacketInformation(messageHeader, isIPv4, &nativePacketInfo))
63
Interop.Error error = Interop.
Sys
.Socket((int)addressFamily, (int)socketType, (int)protocolType, &fd);
75
error = Interop.
Sys
.SetSockOpt(fd, SocketOptionLevel.IPv6, SocketOptionName.IPv6Only, (byte*)&on, sizeof(int));
78
Interop.
Sys
.Close(fd);
110
received = Interop.
Sys
.Read(handle, b, buffer.Length);
111
errno = received != -1 ? Interop.Error.SUCCESS : Interop.
Sys
.GetLastError();
125
errno = Interop.
Sys
.Receive(
150
var iov = new Interop.
Sys
.IOVector {
157
var messageHeader = new Interop.
Sys
.MessageHeader {
164
errno = Interop.
Sys
.ReceiveMessage(
190
sent = Interop.
Sys
.Write(handle, b + offset, count);
193
errno = Interop.
Sys
.GetLastError();
220
errno = Interop.
Sys
.Send(
248
var iov = new Interop.
Sys
.IOVector
254
var messageHeader = new Interop.
Sys
.MessageHeader
263
errno = Interop.
Sys
.SendMessage(
292
Span<Interop.
Sys
.IOVector> iovecs = allocOnStack ? stackalloc Interop.
Sys
.IOVector[IovStackThreshold] : new Interop.
Sys
.IOVector[maxBuffers];
311
fixed (Interop.
Sys
.IOVector* iov = iovecs)
313
var messageHeader = new Interop.
Sys
.MessageHeader {
321
errno = Interop.
Sys
.SendMessage(
366
errno = Interop.
Sys
.SendFile(socket, fileHandle, offset, count, out bytesSent);
383
errno = Interop.
Sys
.GetBytesAvailable(socket, &available);
399
Span<Interop.
Sys
.IOVector> iovecs = allocOnStack ? stackalloc Interop.
Sys
.IOVector[IovStackThreshold] : new Interop.
Sys
.IOVector[maxBuffers];
432
fixed (Interop.
Sys
.IOVector* iov = iovecs)
434
var messageHeader = new Interop.
Sys
.MessageHeader {
441
errno = Interop.
Sys
.ReceiveMessage(
474
int cmsgBufferLen = Interop.
Sys
.GetControlMessageBufferSize(Convert.ToInt32(isIPv4), Convert.ToInt32(isIPv6));
477
Interop.
Sys
.MessageHeader messageHeader;
483
var iov = new Interop.
Sys
.IOVector {
490
messageHeader = new Interop.
Sys
.MessageHeader {
499
errno = Interop.
Sys
.ReceiveMessage(
535
Span<Interop.
Sys
.IOVector> iovecs = allocOnStack ? stackalloc Interop.
Sys
.IOVector[IovStackThreshold] : new Interop.
Sys
.IOVector[buffersCount];
553
fixed (Interop.
Sys
.IOVector* iov = iovecs)
555
int cmsgBufferLen = Interop.
Sys
.GetControlMessageBufferSize(Convert.ToInt32(isIPv4), Convert.ToInt32(isIPv6));
558
var messageHeader = new Interop.
Sys
.MessageHeader
569
errno = Interop.
Sys
.ReceiveMessage(
616
errno = Interop.
Sys
.Accept(socket, rawSocketAddress, &sockAddrLen, &fd);
669
err = Interop.
Sys
.Connectx(socket, rawSocketAddress, socketAddress.Length, data, data.Length, tfo ? 1 : 0, &sentBytes);
674
err = Interop.
Sys
.Connect(socket, rawSocketAddress, socketAddress.Length);
706
err = Interop.
Sys
.Poll(socket, Interop.PollEvents.POLLOUT, timeout: 0, out outEvents);
715
err = Interop.
Sys
.GetSocketErrorOption(socket, &socketError);
1064
Interop.Error err = Interop.
Sys
.GetSockName(handle, buffer, nameLen);
1071
Interop.Error err = Interop.
Sys
.GetBytesAvailable(handle, &value);
1080
Interop.Error err = Interop.
Sys
.GetAtOutOfBandMark(handle, &value);
1092
err = Interop.
Sys
.GetPeerName(handle, rawBuffer, &addrLen);
1101
Interop.Error err = Interop.
Sys
.Bind(handle, socketProtocolType, buffer);
1108
Interop.Error err = Interop.
Sys
.Listen(handle, backlog);
1419
err = Interop.
Sys
.SetReceiveTimeout(handle, optionValue);
1425
err = Interop.
Sys
.SetSendTimeout(handle, optionValue);
1438
var opt = new Interop.
Sys
.IPv4MulticastOption
1445
err = Interop.
Sys
.SetIPv4MulticastOption(handle, Interop.
Sys
.MulticastOption.MULTICAST_IF, &opt);
1451
err = Interop.
Sys
.SetSockOpt(handle, optionLevel, optionName, (byte*)&optionValue, sizeof(int));
1485
Interop.Error err = Interop.
Sys
.SetSockOpt(handle, optionLevel, optionName, pinnedValue, optionValue != null ? optionValue.Length : 0);
1494
Interop.Error err = Interop.
Sys
.SetRawSockOpt(handle, optionLevel, optionName, optionValuePtr, optionValue.Length);
1515
Interop.
Sys
.MulticastOption optName = optionName == SocketOptionName.AddMembership ?
1516
Interop.
Sys
.MulticastOption.MULTICAST_ADD :
1517
Interop.
Sys
.MulticastOption.MULTICAST_DROP;
1522
var opt = new Interop.
Sys
.IPv4MulticastOption
1530
Interop.Error err = Interop.
Sys
.SetIPv4MulticastOption(handle, optName, &opt);
1538
Interop.
Sys
.MulticastOption optName = optionName == SocketOptionName.AddMembership ?
1539
Interop.
Sys
.MulticastOption.MULTICAST_ADD :
1540
Interop.
Sys
.MulticastOption.MULTICAST_DROP;
1542
var opt = new Interop.
Sys
.IPv6MulticastOption {
1547
Interop.Error err = Interop.
Sys
.SetIPv6MulticastOption(handle, optName, &opt);
1553
var opt = new Interop.
Sys
.LingerOption {
1558
Interop.Error err = Interop.
Sys
.SetLingerOption(handle, &opt);
1598
Interop.Error getErrorError = Interop.
Sys
.GetSocketErrorOption(handle, &socketError);
1605
Interop.Error err = Interop.
Sys
.GetSockOpt(handle, optionLevel, optionName, (byte*)&value, &optLen);
1630
err = Interop.
Sys
.GetSockOpt(handle, optionLevel, optionName, null, &optLen);
1650
err = Interop.
Sys
.GetSockOpt(handle, optionLevel, optionName, pinnedValue, &optLen);
1670
Interop.Error err = Interop.
Sys
.GetRawSockOpt(handle, optionLevel, optionName, pinnedValue, &optLen);
1686
Interop.
Sys
.MulticastOption optName = optionName == SocketOptionName.AddMembership ?
1687
Interop.
Sys
.MulticastOption.MULTICAST_ADD :
1688
Interop.
Sys
.MulticastOption.MULTICAST_DROP;
1690
Interop.
Sys
.IPv4MulticastOption opt = default;
1691
Interop.Error err = Interop.
Sys
.GetIPv4MulticastOption(handle, optName, &opt);
1711
Interop.
Sys
.MulticastOption optName = optionName == SocketOptionName.AddMembership ?
1712
Interop.
Sys
.MulticastOption.MULTICAST_ADD :
1713
Interop.
Sys
.MulticastOption.MULTICAST_DROP;
1715
Interop.
Sys
.IPv6MulticastOption opt = default;
1716
Interop.Error err = Interop.
Sys
.GetIPv6MulticastOption(handle, optName, &opt);
1729
Interop.
Sys
.LingerOption opt = default;
1730
Interop.Error err = Interop.
Sys
.GetLingerOption(handle, &opt);
1754
Interop.Error err = Interop.
Sys
.Poll(handle, inEvent, milliseconds, out outEvents);
1833
Interop.Error err = Interop.
Sys
.Poll(events, (uint)eventsLength, milliseconds, &triggered);
1928
Interop.Error err = Interop.
Sys
.Shutdown(handle, how);
2054
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);