Reputation: 9926
I need to write simple TCP listener that will be able to listen TCP ( receive packages ) on one thread and in case i need to send some package i will be able to do it on some other thread
How can i do it ?
Upvotes: 2
Views: 943
Reputation: 1038850
You could use the TcpListener class. It has asynchronous versions of the methods such as BeginAcceptTcpClient which will in turn give you an instance of a TcpClient on which you could call GetStream to reach the underlying stream and from there on continue using the asynchronous versions on this stream to BeginRead and BeginWrite.
Upvotes: 2
Reputation: 12495
One simple project that might guide you: http://www.codeproject.com/KB/IP/TCPIPChat.aspx
Upvotes: 2