From: Dani on
Hello, the following code fails to receive more than 32767 bytes. Does
not return any error and the connection is closed properly. The platform
is Windows Mobile 6 standard on iPaq 214 (also tried other iPaq) VS2005
and CF2.0. Does anyone know help me?
//I ask for the file to the server
writer.Write("file\r\n");
writer.Flush();

//I read what the server responded to my attempt to
authenticate
//The following does not receive more than 32767 bytes
in spite of having given 1mb buffer??
byte[] myReadBuffer = new byte[1024000];
int offsetbyte = 0;
StringBuilder myCompleteMessage = new StringBuilder();
int numberOfBytesRead = 0;
int ammontarebyteRead = 0;
//System.IFormatProvider formatstr;
// ???? Incoming message may be larger than the buffer
size. ??? this code is taken by sample on msdn

do
{
numberOfBytesRead = strm.Read(myReadBuffer, 0,
myReadBuffer.Length);
//offsetbyte += numberOfBytesRead;//for test
ammontarebyteRead += numberOfBytesRead;//for test

myCompleteMessage.Append(Encoding.ASCII.GetString(myReadBuffer, 0,
numberOfBytesRead));
Application.DoEvents();
}
while (!strm.DataAvailable);

Ok,i do not know what to do.
Help.

Dani.
From: Paul G. Tobey [eMVP] paultobey _at_ earthlink _dot_ on
I don't understand why this is a problem. It's up to the network driver,
NDIS, and WinSock to decide how much data comes back. You've asked for a MB,
but if there's some, but not all, of that amount of data available, it's
perfectly reasonable for the stream to return the currently-available data.
Maybe the server took a little longer to send all the data. It certainly
would not all have fit into one packet. You have to accumulate the data
until you've received the amount that you want. There are always delays...

Paul T.

"Dani" wrote:

> Hello, the following code fails to receive more than 32767 bytes. Does
> not return any error and the connection is closed properly. The platform
> is Windows Mobile 6 standard on iPaq 214 (also tried other iPaq) VS2005
> and CF2.0. Does anyone know help me?
> //I ask for the file to the server
> writer.Write("file\r\n");
> writer.Flush();
>
> //I read what the server responded to my attempt to
> authenticate
> //The following does not receive more than 32767 bytes
> in spite of having given 1mb buffer??
> byte[] myReadBuffer = new byte[1024000];
> int offsetbyte = 0;
> StringBuilder myCompleteMessage = new StringBuilder();
> int numberOfBytesRead = 0;
> int ammontarebyteRead = 0;
> //System.IFormatProvider formatstr;
> // ???? Incoming message may be larger than the buffer
> size. ??? this code is taken by sample on msdn
>
> do
> {
> numberOfBytesRead = strm.Read(myReadBuffer, 0,
> myReadBuffer.Length);
> //offsetbyte += numberOfBytesRead;//for test
> ammontarebyteRead += numberOfBytesRead;//for test
>
> myCompleteMessage.Append(Encoding.ASCII.GetString(myReadBuffer, 0,
> numberOfBytesRead));
> Application.DoEvents();
> }
> while (!strm.DataAvailable);
>
> Ok,i do not know what to do.
> Help.
>
> Dani.
> .
>
From: Dani on
Hello Paul,
I've specified a MB beacause the ammount of data ask is much higer than
32767 byte received, but tcpclient receives only first 32767 byte. I
can not tell more ... A correct procedure, sample etc ? a state machine ?


> I don't understand why this is a problem. It's up to the network driver,
> NDIS, and WinSock to decide how much data comes back. You've asked for a MB,
> but if there's some, but not all, of that amount of data available, it's
> perfectly reasonable for the stream to return the currently-available data.
> Maybe the server took a little longer to send all the data. It certainly
> would not all have fit into one packet. You have to accumulate the data
> until you've received the amount that you want. There are always delays...
>
> Paul T.
>
> "Dani" wrote:
From: Paul G. Tobey [eMVP] paultobey _at_ earthlink _dot_ on
You never receive any more data? That sounds like, at some point, your code
is getting confused and asking for zero bytes. I'd step through and, each
time strm.Read() is about to be called, check the values of each of the
parameters, before and after. There's certainly no reason why the framework
would enforce any limit of that sort and I know that it doesn't. Unless the
server is doing this to you, I don't see any other source for the problem.

Paul T.

"Dani" wrote:

> Hello Paul,
> I've specified a MB beacause the ammount of data ask is much higer than
> 32767 byte received, but tcpclient receives only first 32767 byte. I
> can not tell more ... A correct procedure, sample etc ? a state machine ?
>
>
> > I don't understand why this is a problem. It's up to the network driver,
> > NDIS, and WinSock to decide how much data comes back. You've asked for a MB,
> > but if there's some, but not all, of that amount of data available, it's
> > perfectly reasonable for the stream to return the currently-available data.
> > Maybe the server took a little longer to send all the data. It certainly
> > would not all have fit into one packet. You have to accumulate the data
> > until you've received the amount that you want. There are always delays...
> >
> > Paul T.
> >
> > "Dani" wrote:
> .
>
From: Dani on
Thank's Paul,I tested the server with a Windows client written in Delphi
without
finding any limit of sending or receiving. I do not know what to do.

TCPServer Indy Delphi 2007 does not have any parameter to remove the
limit found.

> You never receive any more data? That sounds like, at some point, your code
> is getting confused and asking for zero bytes. I'd step through and, each
> time strm.Read() is about to be called, check the values of each of the
> parameters, before and after. There's certainly no reason why the framework
> would enforce any limit of that sort and I know that it doesn't. Unless the
> server is doing this to you, I don't see any other source for the problem.
>