System.Net.Sockets.SafeCloseSocket.CreateWSASocket C# (CSharp) Méthode

CreateWSASocket() static private méthode

static private CreateWSASocket ( AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType ) : SafeCloseSocket
addressFamily AddressFamily
socketType SocketType
protocolType ProtocolType
Résultat SafeCloseSocket
        internal static SafeCloseSocket CreateWSASocket(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
        {
            return CreateSocket(InnerSafeCloseSocket.CreateWSASocket(addressFamily, socketType, protocolType));
        }

Same methods

SafeCloseSocket::CreateWSASocket ( byte pinnedBuffer ) : SafeCloseSocket

Usage Example

Exemple #1
0
        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);
        }
All Usage Examples Of System.Net.Sockets.SafeCloseSocket::CreateWSASocket