Exemple #1
0
        private static void AcceptCallback(IAsyncResult ar)
        {
            var chanelSocket = serverListenerHandler.EndAccept(ar);
            var chanel       = new Chanel(chanelSocket);

            chanelSocket.BeginReceive(chanel.Buffer, 0, Chanel.BufferSize, 0, new AsyncCallback(ReadCallback), chanel);
        }
Exemple #2
0
        public int Add(Chanel chanel)
        {
            int id = count;

            chanels.Add(count, chanel);
            count++;

            return(id);
        }
Exemple #3
0
        private static void AcceptCallback(IAsyncResult ar)
        {
            allDone.Set();

            var listener     = (Socket)ar.AsyncState;
            var clientSocket = listener.EndAccept(ar);

            var chanel = new Chanel(clientSocket);

            Console.WriteLine("client connected: " + SocketLogger.ChanelInfo(chanel));

            clientSocket.BeginReceive(chanel.Buffer, 0, Chanel.BufferSize, 0, new AsyncCallback(ReadCallback), chanel);
        }
Exemple #4
0
        private static void Send(Chanel chanel, object result)
        {
            var data = Serializer.Serialize(result);

            chanel.ChanelHandler.BeginSend(data, 0, data.Length, 0, new AsyncCallback(SendCallback), chanel);
        }