internal unsafe SocketError DoOperationReceiveMessageFrom(Socket socket, SafeCloseSocket handle, out int bytesTransferred) { int platformFlags = SocketPal.GetPlatformSocketFlags(_socketFlags); bool isIPv4, isIPv6; Socket.GetIPProtocolInformation(socket.AddressFamily, _socketAddress, out isIPv4, out isIPv6); bytesTransferred = 0; return(handle.AsyncContext.ReceiveMessageFromAsync(_buffer, _offset, _count, platformFlags, _socketAddress.Buffer, _socketAddress.Size, isIPv4, isIPv6, ReceiveMessageFromCompletionCallback)); }
internal SocketError DoOperationSendTo(SafeCloseSocket handle, out int bytesTransferred) { int platformFlags = SocketPal.GetPlatformSocketFlags(_socketFlags); SocketError errorCode; if (_buffer != null) { errorCode = handle.AsyncContext.SendToAsync(_buffer, _offset, _count, platformFlags, _socketAddress.Buffer, _socketAddress.Size, TransferCompletionCallback); } else { errorCode = handle.AsyncContext.SendToAsync(_bufferList, platformFlags, _socketAddress.Buffer, _socketAddress.Size, TransferCompletionCallback); } bytesTransferred = 0; return(errorCode); }
internal unsafe SocketError DoOperationReceive(SafeCloseSocket handle, out SocketFlags flags, out int bytesTransferred) { int platformFlags = SocketPal.GetPlatformSocketFlags(_socketFlags); SocketError errorCode; if (_buffer != null) { errorCode = handle.AsyncContext.ReceiveAsync(_buffer, _offset, _count, platformFlags, TransferCompletionCallback); } else { errorCode = handle.AsyncContext.ReceiveAsync(_bufferList, platformFlags, TransferCompletionCallback); } flags = _socketFlags; bytesTransferred = 0; return(errorCode); }