static private CreateWSASocket ( AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType ) : |
||
addressFamily | AddressFamily | |
socketType | SocketType | |
protocolType | ProtocolType | |
return |
public static unsafe SafeCloseSocket CreateSocket(SocketInformation socketInformation, out AddressFamily addressFamily, out SocketType socketType, out ProtocolType protocolType) { SafeCloseSocket handle; Interop.Winsock.WSAPROTOCOL_INFO protocolInfo; fixed(byte *pinnedBuffer = socketInformation.ProtocolInformation) { handle = SafeCloseSocket.CreateWSASocket(pinnedBuffer); protocolInfo = (Interop.Winsock.WSAPROTOCOL_INFO)Marshal.PtrToStructure <Interop.Winsock.WSAPROTOCOL_INFO>((IntPtr)pinnedBuffer); } if (handle.IsInvalid) { SocketException e = new SocketException(); if (e.SocketErrorCode == SocketError.InvalidArgument) { throw new ArgumentException(SR.net_sockets_invalid_socketinformation, "socketInformation"); } else { throw e; } } addressFamily = protocolInfo.iAddressFamily; socketType = (SocketType)protocolInfo.iSocketType; protocolType = (ProtocolType)protocolInfo.iProtocol; return(handle); }
public static SocketError CreateSocket(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType, out SafeCloseSocket socket) { socket = SafeCloseSocket.CreateWSASocket(addressFamily, socketType, protocolType); return(socket.IsInvalid ? GetLastSocketError() : SocketError.Success); }
public static SafeCloseSocket CreateSocket(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType) { return(SafeCloseSocket.CreateWSASocket(addressFamily, socketType, protocolType)); }