Prev: mt
Next: ANN: Seed7 Release 2009-10-04
From: boltar2003 on 25 Sep 2009 06:27 Hi I am writing some code to read ethernet frames off of raw socket on linux created this: socket(PF_PACKET,SOCK_RAW,htons(ETH_P_ALL) The question I have is the behaviour of recvfrom() in this situation. My first question is will it only ever read 1 frame per call or could more than 1 frame appear in the data buffer I give it? My other question is what happens if the frame is longer than my buffer (this shouldn't happen but I need to check)? Will it discard any left over bytes or will they appear on the next read as they would for example reading a TCP stream socket? Thanks for any help B2003
From: liujiusheng on 25 Sep 2009 07:12 On 2009-09-25, boltar2003(a)yahoo.co.uk <boltar2003(a)yahoo.co.uk> wrote: > Hi > > I am writing some code to read ethernet frames off of raw socket on linux > created this: > > socket(PF_PACKET,SOCK_RAW,htons(ETH_P_ALL) > > The question I have is the behaviour of recvfrom() in this situation. > > My first question is will it only ever read 1 frame per call or could more > than 1 frame appear in the data buffer I give it? only one frame per call > My other question is what happens if the frame is longer than my buffer (this > shouldn't happen but I need to check)? Will it discard any left over bytes > or will they appear on the next read as they would for example reading a > TCP stream socket? it will discard the left over bytes. -- Liu Jiusheng
|
Pages: 1 Prev: mt Next: ANN: Seed7 Release 2009-10-04 |