Exemplo n.º 1
0
        public PR2Socket(string ip, int port, string user, string pass, int server_id) : base(ip, port, user, pass, server_id)
        {
            m_Event += new PR2Event(handleRecvLoginID);
            m_Event += new PR2Event(handleRecvSlot);

            this.server_id = server_id;
            this.user      = user;
            this.pass      = pass;
            if (isConnected)
            {
                Send("request_login_id`", null);
            }
        }
Exemplo n.º 2
0
        public BaseSocket(string ip, int port, string user, string pass, int server_id) : base(createIP(port, ip).AddressFamily, SocketType.Stream, ProtocolType.Tcp)
        {
            timer = new Timer(handleTimerElapsed);
            timer.Change(0, 10000);
            IPAddress  m_iAddr    = createIP(port, ip);
            IPEndPoint m_endPoint = new IPEndPoint(m_iAddr, port);

            try
            {
                //BeginConnect(m_endPoint, new AsyncCallback(ConnectCallback), this);
                Connect(m_endPoint);
            }
            catch (SocketException e)
            {
                Console.WriteLine(e.ToString());
            }
            if (Connected)
            {
                isConnected = true;
                Receive();
                m_Event += new PR2Event(handleRecvChat);
            }
        }