Exemplo n.º 1
0
        protected void Server(Object threadContext)
        {
            TcpClient     client = server.AcceptTcpClient();
            NetworkStream stream = client.GetStream();

            SecureStream ss = new SecureStream(stream);

            ss.WriteWrapped("Hello friend, here is the server!".GetBytes());
            byte[] receivedData = ss.ReadWrapped();
            ServerReception = receivedData.GetString();

            if (IsVerbose)
            {
                Console.WriteLine("Server : " + ServerReception);
            }

            DoneEvents[(int)threadContext].Set();
        }
Exemplo n.º 2
0
        protected void Client(Object threadContext)
        {
            TcpClient client = new TcpClient();

            client.Connect(new IPEndPoint(IPAddress.Loopback, 65001));
            NetworkStream stream = client.GetStream();

            SecureStream ss = new SecureStream(stream);

            ss.WriteWrapped("Hello friend, here is the client!".GetBytes());
            byte[] receivedData = ss.ReadWrapped();
            ClientReception = receivedData.GetString();

            if (IsVerbose)
            {
                Console.WriteLine("Client : " + ClientReception);
            }

            DoneEvents[(int)threadContext].Set();
        }