Ejemplo n.º 1
0
    //---------------------------------------------------------------------
    public void close()
    {
        if (mSession != null)
        {
            mSession.Dispose();
            mSession = null;

            if (OnSocketClosed != null)
            {
                OnSocketClosed(null, EventArgs.Empty);
            }
        }
    }
Ejemplo n.º 2
0
    //---------------------------------------------------------------------
    public void connect(string ip, int port)
    {
        mIp   = ip;
        mPort = port;

        EndPoint server_address = new IPEndPoint(IPAddress.Parse(mIp), mPort);

        mSession = new TcpClientSession3(server_address);
        mSession.DataReceived += _onReceive;
        mSession.Connected    += _onConnected;
        mSession.Closed       += _onClosed;
        mSession.Error        += _onError;

        mSession.connect();
    }