469,568 Members | 1,430 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,568 developers. It's quick & easy.

A question about NetworkStream read & write operation inside threads


int x = ns.Read(readbuffer, 0, readbuffer.Length);
catch (System.IO.IOException ioexception)
UINotifications.ServerMessageDisplay(ioexception.T oString( ));
"ns" is an instance of NetworkStream got by calling tcpclient's GetStream()
"UINotifications" is my own calss.

this code is running is a seperate thread and as can be seen it will be in a
blocking state as it executes the "read" function. My question is that while
it is in this blocking state, I want to perform a write operation. Would
that be valid operation? And how do I make the write operation execute in
this same thread (isnt it blocked)? Will I have to take a reference of the
networkstream obj and use it from another thread to write to the stream? But
I dont want to write from another thread. Its kind of confusing me.
Any guidence greatly appriciated !


Nov 17 '05 #1
0 1335

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by 0to60 | last post: by
1 post views Thread by kmacintyre | last post: by
7 posts views Thread by fairyvoice | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.