Socket send blocking problem

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Andy (anonymous_at_discussions.microsoft.com)
Date: 05/11/04


Date: Tue, 11 May 2004 11:41:05 -0700

Hi,
I've got an issue that I'm having some difficulty explaining.
I'm running a TCP socket connection across a very slow network (low bandwidth).
I am generating data faster than the transport layer can send it.
The send buffer (as defined with SO_SNDBUF) gets filled, then data essentially stops getting transmitted.
Up until the point that the send buffer is filled, data is received at a reasonably steady rate at the other end.
I'm intentionally sending a lot of small packets (nagles is disabled.. though I can see the issue either way).
It doesn't completely stop sending. It will start up again, generally with a larger packet size (even with nagles disabled) and start sending again for some short period of time. It's a bit cyclical.
The xmit side just blocks until there is data space available to put into the send call.
My question is why does the data stop getting to the other end just because my send buffer gets filled up?
It somewhat is acting like it is in a retry delay of some sort.
My second and probably more important question is there some way to peek at how much data is queued up in the kernel send buffer (size defined by SO_SNDBUF)?
Is there a way to flush it?
SO_SNDBUF set to zero won't cut it for me, as I don't want to wait for every transaction to to acked by the far end.
I also have a lot of code written already to use the blocking send. I'd rather not have to use the sockets in a non-blocking mode if I can avoid it.

Thanks in advance..
Andy



Relevant Pages

  • Re: In-tree version of new FireWire drivers available
    ... Just to recap, the dual buffer receive mode, as described in section ... quadlet aligned amount of header data can be appended into one buffer ... *either* the header buffer or the payload buffer fills up. ... enough to hold headers for all the packets it takes to fill up the ...
    (Linux-Kernel)
  • Re: Deaf CAsyncSocket on Windows Service.
    ... To read them out I need a buffer to ... Short packets at the sender are coalesced into longer packets. ... THe receiver says "I have this much buffer space" and the sender is free to send ... You get an OnReceive notification if there is input data to be read. ...
    (microsoft.public.vc.mfc)
  • Re: Cisco 7204VXR Interface ignored packet
    ... Input queue drops (ignored packets) are usually due to buffers not being ... The buffer defaults are good 98% of the ... 256 max cache size, 256 in cache ... 22496866 hits in cache, 0 misses in cache ...
    (comp.dcom.sys.cisco)
  • Re: Persistent stall in the Cypress FX2 FIFO
    ... the FX2's firmware code, would be to install some sort of stub routines ... > how long they are (it appends even for 4 byte long packets). ... > a packet from the FIFO before sending the next one all works fine... ... smaller or larger than what a single buffer could hold. ...
    (comp.arch.embedded)
  • Re: Waveform Audio - MMSYSERR_INVALPARAM
    ... Also, packets/buffers that you waveOutWrite, are packets ... right after the last sample from the previous buffer seamlessly. ... the waveOutWrite function DON'T return the error. ...
    (microsoft.public.pocketpc.developer)