The optimized way of receiving the data on the socket while doing select.
Scenario :
-- Do select on "N" number of file descriptors, based on the FD_ISSET do receive the packet buffer.
-- what happens when there are packets are in stream, (i.e) they are just yet to be copied to socket receive buffer by linux kernel.
-- Obviously after processing the packet, the control go back to select operation
-- Thus having more packets written to the socket receive buffer during burst scenario, the socket buffer will get full and packets will be lost
-- The optimized approach is to, do IOCTL call to that socket fd, and get the available receive buffer length before doing receive packet buffer.
-- Its very optimistic way recently i have experienced this approach..
-- It works pretty cool..
-- you would need to add your code in kernel soo_ioctl function.. get the struct socket so_rcv.sb_cc -- i.e length of socket receive buffer
No comments:
Post a Comment