How to read all data from kernel buffer for a socket fd (which uses TCP )

Discussion in 'Linux Networking' started by will_u_tellmemore, Dec 21, 2006.

  1. Hi all,

    What i want to know is , is there a way to read all the data that is in
    the kernel buffer for a socket fd ??
    (which is socket fd for a TCP connection). I can make sure , new data
    is not coming in kernel buffer for this
    fd. I will be using kernel module which inserts hooks with netfilter
    and drop all packets for that connection when that module is told to do
    so.

    Can i use non blocking read calls with large count and calling this
    read multiple times ?? Is there guarantee
    that all the data that is in the kernel buffer if there is some data
    with non-blocking read ?? And i can safely
    conclude from return value that i have read everything .

    Is there anything that can go wrong in this ?? Can non blocking read
    return even when there is data to be read
    without specifying correct return value ??

    Or if this is not possible and i know how many bytes of data is lying
    in kernel buffer for this fd
    can i just issue a blocking call with that count and get all data till
    i get everything ??

    Thanks ,
    Rohit
     
    will_u_tellmemore, Dec 21, 2006
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.