i am (still) working on a program to receive ethernet-frames:

when i use recvfrom on the packet socket (SOCK_PACKET), i always get the
error EBADF (Bad file number) _after_ the first packet has been
_successfully_ received. the next call to recvfrom in the while loop causes
the error.

when i try it with recvmsg, it works fine, but i wonder why it doesn't work
with recvfrom.

anyhow, i don't really understand the concept of the iovec struct of
recvmsg. why would i want to have a buffer array for the one ethernet-frame
i can receive at a time?

i would greatly appreciate any explanations.

thanks, 
Br1

this is the code with recvfrom:

while (1) /* forever */
{
      len = recvfrom( s, buff, ETH_FRAME_LEN, 0, &sa, &salen ); 
      /* stripped error checking code */
      printf("received packet (len: %d, type: %X, dev: %s)\n", len, 
             sa.sa_family, sa.sa_data);
}




------------------------------------------------
The facts, although interesting, are irrelevant.
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]

Reply via email to