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)); } }
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)); } }