Re: delay on select()

From: Andrei Voropaev (avorop_at_mail.ru)
Date: 12/31/03

  • Next message: Andrei Voropaev: "Re: delay on select()"
    Date: 31 Dec 2003 09:46:55 GMT
    
    

    On 2003-12-31, David Schwartz <davids@webmaster.com> wrote:
    >
    > "Andrei Voropaev" <avorop@mail.ru> wrote in message
    > news:bsrc0a$jb02$2@ID-205467.news.uni-berlin.de...
    [...]
    >> Better to use
    >> socket options in this case. (Though I'm not sure about being portable
    >> here). Anyway. On Linux man 7 tcp lists TCP_NODELAY that
    >> allows immidiate sending of data in the TCP buffers, the reverse of it
    >> is TCP_CORK that allows to assemble package in system buffers and then
    >> send it as one.
    >
    >
    > Instead of setting 'TCP_CORK', just write the data to an intermediate
    > buffer instead of the socket. Instead of unsetting 'TCP_CORK', flush the
    > buffer to the socket. It will do almost exactly the same thing and have the
    > advantage of being fully portable.

    Well. I don't want to argue about taste matters. Personally I don't like
    to maintain intermidiate buffer, grow, shrink, release it. Then you have
    to copy the same stuff twice. First to intermidiate buffer, then into
    system buffers. Then Nagle algorithm is still in the play and if your
    data is still too short then it won't go away immediately. Using
    TCP_CORK I give up portability (which I don't need for most stuff that I
    write anyway), but I gain speed a little bit. Again this is the matter
    of personal preferences.

    >
    > Setting TCP_NODELAY won't help you. Setting this flag is promising the
    > stack that you will do the coalescing so that it doesn't have to. This is
    > only acceptable if you do the coalescing. Someone has to coalesce, otherwise
    > you send too many small packets.

    Won't help me? In SMPP protocol each PDU is not more than 300 bytes long
    and the next one won't come untill the response to the first one
    arrived. So small datagrams are inevitable in this case. That is why I
    have to turn Nagle off using TCP_NODELAY. And it does help me. :)

    I believe everything has its value, but in appropriate places :)

    Andrei


  • Next message: Andrei Voropaev: "Re: delay on select()"

    Relevant Pages

    • Re: Communication speed between blocking call and non blocking cal
      ... You could use event based notification, ... When you use nonblocking I/O, the system may have to perform extra buffering ... data buffer until you say that you are done with it. ... I checked default socket buffer ...
      (microsoft.public.win32.programmer.networks)
    • Re: Can someone help me
      ... // contents from the server to the client public class AsynchNetworkFileServer {class ClientHandler {// constructor public ClientHandler(Socket socketForClient) {// initialize member variable socket = socketForClient; // initialize buffer to hold ... // contents of file buffer = new byte; // create the network stream networkStream = new NetworkStream; // set the file callback for reading ...
      (microsoft.public.dotnet.languages.csharp)
    • Re: [PATCH] CONFIG_PACKET_MMAP should depend on MMU
      ... The entire data buffer is allocated as one contiguous lump in NOMMU-mode. ... +#ifndef CONFIG_MMU ... * find out where the socket buffers are so that NOMMU mmap can return the ...
      (Linux-Kernel)
    • Re: Socket stuck with puts over ADSL line
      ... gets stuck with the puts command within the filevent writeable ... Is the socket configured as -blocking 1? ... local buffer would fill rapidly, ... buffered portion across the WAN as its own TCP packet, ...
      (comp.lang.tcl)
    • Re: Communication speed between blocking call and non blocking cal
      ... Yes i set winsock kernel buffer to 5MB. ... I got good speed and I tested for blocking and nonblocking socket and got ... Problem was I did not set winsock kernel buffer. ...
      (microsoft.public.win32.programmer.networks)