472,808 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,808 software developers and data experts.

Networkstream Write problem

I have a TCP server to which a number of mobile devices connect. If a device
disconnects(mostly no clean close as they usually lose cell coverage or
shutdown), and the server then tries to send data using the
Networkstream.Write method, its NOT throwing an exception. I am using the
TCPClient class.
I am able to reproduce this by shutting down my test device(turning off
power) and then sending some data. The Write just finishes as if the data
was sent.
Is there some timeout that has to occur before the Write fails ?
Even the CanWrite returns true. Here is part of the code that writes

if (Cmd != "")
byte[] OTA = Encoding.ASCII.GetBytes(Cmd);
{ //JUst to check for connection }
catch (SocketException) //remote closed
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 ?


Srinivas Loka
Jul 21 '05 #1
0 2191

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: cmjman | last post by:
I have an issue where networkStream.Write doesn't perform its write downstream from my client program until the network stream is closed. I then see the data that was sent appear on the other side....
by: Casey Watson | last post by:
Hi :) I'm having some major trouble with an XML Client/Server application that I am writing. I am using NetworkStream with CryptoStream to Read and Write XML between computers. Now, whenever I...
by: Sven Huijbrechts | last post by:
Hello, I need to send a couple of "NUL"s -> HEX value "00" on a networkstream.. This is the code we currently use to send string: Dim sendBytes As () =...
by: david.topham | last post by:
Hi The code below demostrates an issue I'm having with with NetworkStream: using System; using System.Net.Sockets; namespace TCPCTest { class Class1
by: hamid_2020 | last post by:
I wrote a class to connect to a server using tcpclient. I need to connect to the server and the connection must be open.Then i need to send request to the server again and again.But the problem is...
by: | last post by:
I've got a basic "chat" infrastructure that can send objects across the wire, but I'm running into a few issues with trying to send multiple messages and things behaving differently in debug and...
by: shahla.saeed | last post by:
hi, plzz check my code and let me know where the problem is lying...becuase whenever i try to tansfer the file of 573KB(mp3) it just tranfer few Kb of file(Somtimes 5.2Kb,somtimes 32Kb..every time...
by: etnaelk | last post by:
Hi all, I have a real bugger of a problem that I just haven't been able to figure out. I am working on writing my own proxy server in C# using TcpListener, TcpClient, HttpWebRequest/Response and...
by: littleIO | last post by:
Hi, I'm stuck on a very simple problem and just cant seem to get around it, little help would be much appreciated. I have a server which listens, receives calls, processes them and sends back the...
by: Almund | last post by:
Hi, I'm trying to implement streaming over http and got stuck with a problem trying to send chunks of data using the .Net NetworkStream object. All works fine as long as I send the entire data in...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: lllomh | last post by:
How does React native implement an English player?
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.