Re: Reading blocks of data from socket



Dilip wrote:

Hi

I have an application that connects to server via TCP. Right now, the
way the protocol is designed, I read a few bytes initially from the
socket, say 'n'. One of the fields in the n bytes tells me how much
more to read to absorb the entire packet of data. I read that much,
loop back and repeat the process by once again reading n bytes. I do
this kind of looping close to 100,000 times over a span of 3-4 mins.
The application is designed to do this kind of thign all day.

I was just wondering, wouldn't it be a good idea to read a huge block
of data (say like 10,000 bytes) from the socket, store it in memory and
let the program logic interpret the packets in-memory rather than from
the socket thus reducing the amount of I/O?

That is how I do it.

--
Phil Frisbie, Jr.
Hawk Software
http://www.hawksoft.com
.



Relevant Pages

  • HEADS UP: network stack and socket hackery over the next few weeks
    ... Over the next few weeks, I'll be doing a fairly serious workworking of the socket and protocol reference models, in order to clean up a number of long-standing race conditions and provide infrastructure for significant locking optimizations for several protocols (including TCP). ...
    (freebsd-current)
  • Re: Letting a Python application phone home
    ... You need to define a protocol for the communication ... Look at the python module "socket" resp. ... "SocketServer" for low level tcp functions. ... let your program contact the server periodically. ...
    (comp.lang.python)
  • Re: Multithread safety
    ... > If your protocol is TCP, then yes, you need to reassemble the read ... This whole discussion was about TCP ... > same socket at the same time. ... As for WSARecv/WSASend the way they are posted depends on the ...
    (microsoft.public.win32.programmer.networks)
  • Re: Reading blocks of data from socket
    ... I have an application that connects to server via TCP. ... way the protocol is designed, I read a few bytes initially from the ... socket, say 'n'. ... let the program logic interpret the packets in-memory rather than from ...
    (microsoft.public.win32.programmer.networks)
  • Re: Reading blocks of data from socket
    ... I have an application that connects to server via TCP. ... way the protocol is designed, I read a few bytes initially from the ... socket, say 'n'. ... let the program logic interpret the packets in-memory rather than from ...
    (microsoft.public.win32.programmer.networks)