Пример #1
0
 /// <summary>
 /// 释放资源
 /// </summary>
 public override void Dispose()
 {
     if (IsDisposed == 0)
     {
         base.Dispose();
         DisposeSocket();
         SocketWait.Set();
     }
 }
Пример #2
0
 private void createSocket(IPAddress ipAddress, int port, int createVersion)
 {
     if (check(ipAddress, port))
     {
         CreateSocket = new ClientSocket(this, ipAddress, port, createVersion);
     }
     else
     {
         SocketWait.Set();
     }
 }
Пример #3
0
 /// <summary>
 /// 释放资源
 /// </summary>
 public override void Dispose()
 {
     if (IsDisposed == 0)
     {
         base.Dispose();
         if (CreateSocket != null)
         {
             (CreateSocket as ClientSocket <attributeType>).DisposeSocket();
         }
         SocketWait.Set();
     }
 }
Пример #4
0
 /// <summary>
 /// 尝试创建第一个套接字
 /// </summary>
 public void TryCreateSocket()
 {
     if (Interlocked.CompareExchange(ref CreateVersion, 1, 0) == 0)
     {
         IPAddress ipAddress = IpAddress;
         int       port      = Port;
         if (check(ipAddress, port))
         {
             CreateSocket = new ClientSocket(this, ipAddress, port, 1);
         }
         else
         {
             SocketWait.Set();
         }
     }
 }