z/OS Communications Server

  • 1.  How does TCP/IP use buffers ?

    Posted Mon April 15, 2024 04:55 AM

    A colleage was recently testing a TCP/IP C/C++ application on a very little used test LPAR and got return code 1122 from a setsockopt() call tp ste the send buffer size to 1024000. RC 1122 means "EDC8122I No buffer space available".  I have been asked to do some research on how TCP/IP bufferring works.  Does anyone know of a presentation or document which describes this ?.

    In particular:

    • are any buffers allocated in the user address space ?
    • is a buffer allocated when the socket is initialised or only when a buffer is required for send or receive ?

    From what I have read so far and previous knowledge I believe that TCPIP only uses CSM buffers and my assunption from the failure of the sectsockopt() call is that an initial buffer is allocated but it would be good to get a complete overview of the process.



    ------------------------------
    Keith Gooding
    ------------------------------


  • 2.  RE: How does TCP/IP use buffers ?

    IBM Champion
    Posted Tue April 16, 2024 02:00 AM
    Check you have region=0m in your job. The rc may come from a malloc routine failure.
    I think  the buffers are in your region. I think tcpip used to move data around, then changed it to pass the address of the buffer, and so got a big performance boost.
    Colin 





  • 3.  RE: How does TCP/IP use buffers ?

    Posted Tue April 16, 2024 06:00 AM
    Edited by Keith Gooding Tue April 16, 2024 06:02 AM

    Thank you Colin.

    The problem turned out to be 'working as designed' - the application tries for a very large buffer and if that fails it re-tries using smaller sizes until success. This would not normally be apparent but detailed tracing was turned on. 

    We had the default for TCPMAXSNDBUFRSIZE (256K), which was not large enough. Dynamic Right Sizing, if active, would have increased this to 2MB so I need to now understand DRS.

    If I understand you correctly you are saying that TCPIP does now allocate a buffer in the application region. That is not clear from any of the documentation I have seen and a search for EDC8122I throws up https://www.ibm.com/support/pages/node/342457 which is about CSA and ECSA storage.

    So my real question remains: is there is a presentation or document which summarizes TCPIP buffering so that we can see some of the inner workings.

    Best regards

    Keith Gooding

     



    ------------------------------
    Keith Gooding
    ------------------------------



  • 4.  RE: How does TCP/IP use buffers ?

    IBM Champion
    Posted Wed April 17, 2024 03:37 AM
    Keith,

    On the recv request you specify a buffer and it's size.this is what your app gets.

    There is another buffer. You set the size with the set sockoptions.  If this buffer fills, it sends a slow down request to the sender.  (I think this is the length of the free space in this buffer.). If there is no space the sender stops sending.  As your ap gets data, this makes more space in the buffer and so, the remote end sends data.
    The size of this buffer can increase due to drs.
    The buffer concept is really simple which explains why it is not documented.

    As well as receive buffer there are send buffers.

    I'm on holiday at the moment, I have more info at home 
    Colin






  • 5.  RE: How does TCP/IP use buffers ?

    IBM Champion
    Posted Thu April 18, 2024 03:16 AM
    There is a callable service bpx1rcv ? Which is a low level interface.  I think you specify address of buffer and alet.