Ejemplo n.º 1
0
        protected override void AcceptedSocket(TinySocket sock)
        {
            var client = new TCPClient(sock);

            lock (Clients)
                Clients.Add(client);

            sock.OnSocketClosedEvent += () =>
                {
                    lock (Clients)
                        Clients.Remove(client);
                };

            NotifySocketClientAccepted(client);
        }
Ejemplo n.º 2
0
        public TCPClient(TinySocket sock)
        {
            m_Socket.OnConnectedEvent += () =>
                {
                    IsConnected = true;
                };

            m_Socket.OnDataReceivedEvent += (b) =>
                {
                    OnReceivedDatas(b);
                };

            m_Socket.OnSocketClosedEvent += () =>
                {
                    IsConnected = false;
                    OnDisconnectedSocket();
                };

            m_Socket.OnFailedToConnectEvent += (e) =>
                {
                    OnConnectFailed(e);
                };
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Method called when socket accepted
 /// </summary>
 protected abstract void AcceptedSocket(TinySocket sock);