A question about NetworkStream read & write operation inside threads
- From: "Abubakar" <abubakarm@xxxxxxxxx>
- Date: Thu, 17 Nov 2005 16:08:36 +0500
Hi,
try
{
int x = ns.Read(readbuffer, 0, readbuffer.Length);
}
catch (System.IO.IOException ioexception)
{
UINotifications.ServerMessageDisplay(ioexception.ToString( ));
}
"ns" is an instance of NetworkStream got by calling tcpclient's GetStream()
function.
"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 !
Thanks,
-Ab.
.
- Prev by Date: Re: Message Passing Techniques
- Next by Date: Re: Version take
- Previous by thread: runtime change in web.config
- Next by thread: Re: Transaction Problem in upgrading an ASP.Net + C# Application from
- Index(es):