Is TcpClient BeginRead/Send thread safe?

Posted by wb on Stack Overflow See other posts from Stack Overflow or by wb
Published on 2010-04-06T07:22:39Z Indexed on 2010/04/06 7:43 UTC
Read the original article Hit count: 419

Filed under:
|
|
|
|

Using a dotNET TcpClient if I have called an asynchronous BeginRead() on the associated network stream can I still call Write() on that stream on another thread?

Or do I have to lock() the TcpClient in the code that is called back from the BeginRead and the code that does the send?

Also if I close the TcpClient with:

client.GetStream().Close(); client.Close();

Do I have to lock() on the TcpClient as well?

Thanks in advance.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET