Ejemplo n.º 1
0
 public override void Close()
 {
     if (socket != null)
     {
         socket.Close();
         socket = null;
     }
 }
Ejemplo n.º 2
0
 public override void Reconnect()
 {
     if (socket != null)
     {
         socket.Connect(netPoint);
     }
     else
     {
         socket             = new NetSocket();
         socket.onConnect   = OnNetConnect;
         socket.onRecv      = OnRecvCmd;
         socket.onReconnect = OnReconnect;
         socket.Connect(netPoint);
     }
     Invoke("CheckConnectTimeOut", timeout);
 }
Ejemplo n.º 3
0
        public override void Connect(string host, int port, int timeout, Action <bool, string> onConnect, Action <int, byte[]> onReceive, Action onFailed)
        {
            netPoint = new NetPoint()
            {
                host = host, port = port
            };
            this.timeout = timeout;

            socket             = new NetSocket();
            socket.onConnect   = OnNetConnect;
            socket.onRecv      = OnRecvCmd;
            socket.onReconnect = OnReconnect;
            socket.Connect(netPoint);

            Invoke("CheckConnectTimeOut", timeout);
        }