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(_NetworkStre am.DataAvailabl e)
{
//JUst to check for connection
}
}
catch (SocketExceptio n) //remote closed
{
this.CloseSocke t();
return;
}
if(_NetworkStre am.CanWrite)
{
_NetworkStream. Write(OTA,0,(in t)OTA.Length);
}
}
catch(Exception eOTA)
{
Controller.EMai lErr("OTA Send Error",eOTA.Mes sage.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******** ******@TK2MSFTN GP09.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(t cp, true);
if (ns.CanWrite)
{
ns.Write(myByte s, 0, 256);
}
---
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/