Пример #1
0
        public void TestServerLogger()
        {
            SendSocket s = new SendSocket();
            s.Connect(serverIp, serverPort, localPort);
            s.Send("HELLO WORLD!");
            s.Send("CAN YOU HEAR ME?");

            System.Threading.Thread.Sleep(4000);

            s.Send("HELLO..?");
        }
Пример #2
0
        public void TestReadTask()
        {
            SendSocket sSock = new SendSocket();
            sSock.Connect(localhost, recvPort, sendPort);

            RecvSocket rSock = new RecvSocket();
            rSock.Connect(recvPort);
            rSock.BeginRead();

            for(int i = 0; i < 10; ++i)
            {
                System.Threading.Thread.Sleep(1000);
                SendString(sSock,String.Format("{0} : Hello World", i));
            }
        }
Пример #3
0
        public void TestStopRead()
        {
            SendSocket sSock = new SendSocket();
            sSock.Connect(localhost, recvPort, sendPort);

            RecvSocket rSock = new RecvSocket();
            rSock.Connect(recvPort);
            rSock.BeginRead();

            for(int i = 1; i < 11; ++i)
            {
                System.Threading.Thread.Sleep(1000);
                // kill read half way through
                if(i % 5 == 0)
                {
                    rSock.EndRead();
                }
                SendString(sSock, String.Format("{0} : Hello World", i));
            }
        }
Пример #4
0
 // sends a string lol
 private void SendString(SendSocket sendSock, string message)
 {
     sendSock.Send(message);
 }