Thanks for the reply.
Yes I am using the NetworkStream. Even the CanWrite returns true. Here is
part of the code that writes
if (Cmd != "")
{
try
{
byte[] OTA = Encoding.ASCII.GetBytes(Cmd);
try
{
if(_NetworkStream.DataAvailable)
{
//JUst to check for connection
}
}
catch (SocketException) //remote closed
{
this.CloseSocket();
return;
}
if(_NetworkStream.CanWrite)
{
_NetworkStream.Write(OTA,0,(int)OTA.Length);
}
}
catch(Exception eOTA)
{
Controller.EMailErr("OTA Send Error",eOTA.Message.ToString());
}
}
The mobile unit is a third party device and I just power it down to simulate
a lost TCP connection.
I even used DataAvailable as it is supposed to throw an exception if remote
disconnects. Even after I shutdown the remote device, the CanWrite returns
true and the Write does not thrown an exception.
The mobile unit connects using a wireless cellular network(ATT/cingular) -
would that have something to do with it ?
Thanks again
"AstroDrabb" <AstroDrabb@-NOSPAM-yahoo.com> wrote in message
news:uy**************@TK2MSFTNGP09.phx.gbl...
Are you using a NetworkStream to write? If so, just check the CanWrite
property.
TcpClient tcp = new TcpClient("www.google.com", 80);
NetworkStream ns = new NetworkStream(tcp, true);
if (ns.CanWrite)
{
ns.Write(myBytes, 0, 256);
}
---
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/