Re: how to retreive WHOLE buffer with recv()

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Arkady Frenkel (arkadyf_at_hotmailxdotxcom)
Date: 12/03/04


Date: Fri, 3 Dec 2004 18:50:35 +0200

MTU ( max transport unit ) size of ethernet ( probably used in the case )
is 1500 bytes so server send at least 5 packets and not single one which
constructed on CE size on receive
Arkady

"Paul G. Tobey [eMVP]" <ptobey no spam AT no instrument no spam DOT com>
wrote in message news:O$NX3NI2EHA.3336@TK2MSFTNGP11.phx.gbl...
> That's probably the TCP/IP stack, *not* the Windows CE code that's doing
it.
> Capture the packets to verify. If it is split into several packets, you
> can't get it all at once necessarily no matter what you do. There will
> always be situations where it will arrive separated in time by enough to
> cause some to be returned in one recv call and some in another. So, the
> moral of the story is, write your code to handle the data coming in in
> pieces and you won't have to worry about it.
>
> Paul T.
>
> "George" <gpn2atpitt.edu> wrote in message
> news:%23qZUx6F2EHA.2196@TK2MSFTNGP14.phx.gbl...
> > Hey guys, I was wondering if it is possible to retreive a whole buffer
> > through a recv() call on a socket. I have a java server that sends out
> > like
> > 7200 bytes or so, and my recv() calls in c++ ALWAYS want to break it up
> > into
> > like 1000, then like 6200 or so.
> >
> > nRecv = recv(wcsock, tempData, 10000, 0);
> >
> > (tempData has a size of 10000)
> > Is there any way to get it to read all the data waiting to be read with
> > recv() all at once?
> >
> > I saw in the msdn that a MSG_PEEK flag will " subsequently returns the
> > amount of data that can be read in a single call to the recv()"
> >
> > But everytime I try to add the MSG_PEEK flag to my recv() call, it
> > returns -1.
> >
> > How can i receive the whole buffer at once?
> >
> >
>
>



Relevant Pages

  • Re: Socket switch delay
    ... The server uses blocking sockets just because I am also using Overlapped IO ... structures to send the packets. ... The reason I am using a 0 bytes send buffer in my socket (i.e. ...
    (microsoft.public.win32.programmer.networks)
  • Receive binary file through recv
    ... I am trying to send a binary file from the client to the server. ... in a buffer,, and on the server side, I wonder when I ... Directly recv to file: ...
    (comp.unix.programmer)
  • multiple recv() calls required
    ... I connectand the server sends the banner, but I don't recv() it. ... send the DEFINE command. ... the buffer when there is enough room for part of the definition as well. ...
    (comp.unix.programmer)
  • Re: Grouping NIC interrupt requests
    ... an Ethernet NIC throws an interrupt request ... If I receive a high rate of small packets, ... I would think a NIC can buffer at least 50 frames. ... your server to its knees you need more server. ...
    (comp.dcom.lans.ethernet)
  • Re: How can I prevent TCP/IP from grouping together multiple SendText requests into one packet?
    ... > Right now my client sends the word "UPDATE" to my server and the server ... > gets very hard to parse them on the client... ... There are no TCP packets, there is only a TCP stream. ... "name=value" pairs, each terminated by a CRLF, you can buffer the ...
    (comp.lang.pascal.delphi.misc)