2013年8月31日星期六

linux socket buffer full of how to do ?

Let embedded device and PC communication using UDP , Ethernet transmit data quickly , the receiver sends the processing speed can not keep up the speed , how to handle it ?

have tried to socket buffer space is set to the maximum allowed space for drop in the bucket compared to the amount of data , the result is behind the data packets are discarded.

Has anyone encountered this problem, pointing twelve , thank you.
------ Solution ---------------------------------------- ----
1, the sender do not send too fast ;
2, when the receiver receives only receives , there can be a buf, buf open thread to handle the data .
------ Solution ---------------------------------------- ----
sender uses reactor mode, you need to send the data stored in the buffer , socket when you do actually sent writable
receiving end of the business separate thread and IO thread
------ Solution --------------------------- -----------------
packet size not larger than the MTU, but also not too small . However, these seem related stuff does not matter.

1 can not be there to receive information over time to open up a new thread to handle these messages

2 over UDP , based on the channel mode should be added , when all the information received , send a letter back to the sender to send data again
( QQ news is that now looks like this mechanism )
3 allows the sender wait for a while after each send one ( like quite a waste ! )

currently thought these
------ For reference only ------------------------------ ---------
no solution, transfer multimedia ? UDP no flow control, can only proceed from the business improvement . Multimedia on degraded
------ For reference only --------------------------------- ------
UDT directly on it. . . UDP develop their own reliable transport is not necessary that the human toll .
------ For reference only -------------------------------------- -
Thank you for your enthusiastic response , knot posted

没有评论:

发表评论