Raw socket sendto() failure in OS X

Posted by user37278 on Stack Overflow See other posts from Stack Overflow or by user37278
Published on 2010-03-12T08:38:15Z Indexed on 2010/03/13 13:25 UTC
Read the original article Hit count: 348

Filed under:
|
|

When I open a raw socket is OS X, construct my own udp packet (headers and data), and call sendto(), I get the error "Invalid Argument". Here is a sample program "rawudp.c" from the web site http://www.tenouk.com/Module43a.html that demonstrates this problem. The program (after adding string and stdlib #includes) runs under Fedora 10 but fails with "Invalid Argument" under OS X. Can anyone suggest why this fails in OS X? I have looked and looked and looked at the sendto() call, but all the parameters look good. I'm running the code as root, etc. Is there perhaps a kernel setting that prevents even uid 0 executables from sending packets through raw sockets in OS X Snow Leopard? Thanks.

© Stack Overflow or respective owner

Related posts about sockets

Related posts about macosx