public virtual void Close()
 {
     lock (this)
     {
         Socket socket = this.socket;
         if (socket != null)
         {
             MalockInnetSocket.Close(socket);
         }
         this.socket = default(Socket);
     }
 }
示例#2
0
 private void ProcessAborted()
 {
     lock (this.syncobj)
     {
         Socket socket = this.socket;
         if (socket != null)
         {
             MalockInnetSocket.Close(socket);
         }
         this.connected = false;
     }
     this.OnAborted(EventArgs.Empty);
 }
示例#3
0
 public MalockStandbyClient(string identity, string address, int listenport)
 {
     this.socket = new MalockInnetSocket(identity, address, listenport, MalockMessage.LINK_MODE_SERVER);
     do
     {
         this.Identity   = identity;
         this.Address    = address;
         this.listenport = listenport;
     } while (false);
     this.socket.Received  += this.OnReceived;
     this.socket.Connected += this.OnConnected;
     this.socket.Aborted   += this.OnAborted;
     this.socket.Run();
 }
示例#4
0
 public MalockStandbyClient(MalockEngine engine, string identity, string address, int listenport)
 {
     if (engine == null)
     {
         throw new ArgumentNullException("engine");
     }
     this.engine = engine;
     do
     {
         this.Identity   = identity;
         this.Address    = address;
         this.listenport = listenport;
     } while (false);
     this.socket           = new MalockInnetSocket(identity, address, listenport, MalockMessage.LINK_MODE_SERVER);
     this.socket.Received += this.OnReceived;
     this.socket.Run();
 }
示例#5
0
 public MalockStandbyClient(MalockEngine engine, MalockConfiguration configuration)
 {
     if (configuration == null)
     {
         throw new ArgumentNullException("configuration");
     }
     if (engine == null)
     {
         throw new ArgumentNullException("engine");
     }
     this.configuration = configuration;
     this.engine        = engine;
     do
     {
         this.Identity   = configuration.Identity;
         this.Address    = this.GetAddress(configuration);
         this.listenport = configuration.Port;
     } while (false);
     this.socket            = new MalockInnetSocket(this.Identity, this.Address, this.GetListenPort(), MalockMessage.LINK_MODE_SERVER);
     this.socket.Received  += this.OnReceived;
     this.socket.Connected += this.OnConnected;
     this.socket.Aborted   += this.OnAborted;
     this.socket.Run();
 }