Esempio n. 1
0
 /// <summary>
 /// Initiates use of the Winsock DLL by the current process.
 /// </summary>
 /// <param name="requestedVersion">
 /// Type: <see cref="yourmt.Sockets.WinSockVersion"/>
 /// The requested <see cref="WinSockVersion"/>.
 /// </param>
 public WsaWrapper(WinSockVersion requestedVersion)
 {
     _data = new WsaData();
     Int32 res = WinSock2.WSAStartup(requestedVersion, ref _data);
     if(res != 0)
         throw new Win32Exception(res); // WSAStartup returns the error value by itself
 }
Esempio n. 2
0
 public static extern Int32 WSAStartup(WinSockVersion wVersionRequested, ref WsaData wsaData);
Esempio n. 3
0
 public static extern int WSAStartup(
     UInt16 wVersionRequested,
     WsaData wsaData);
 private static extern int WSAStartup(short wVersionRequested, ref WsaData lpWSAData);
 static extern int WSAStartup(Int16 wVersionRequested, ref WsaData lpWSAData);
 public DiscoveryBase()
 {
     lock (refCountLock)
     {
         if (refCount == 0)
         {
             WsaData WinsockVersion = new WsaData();
             int ret = WSAStartup(UnsafePnrpNativeMethods.RequiredWinsockVersion, ref WinsockVersion);
             if (ret != 0)
             {
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SocketException(ret));
             }
         }
         refCount++;
     }
 }