PDA

View Full Version : problems with freebsd


afpr
09-01-2006, 06:55 PM
Hello, I'm trying to make a server-client application, in freeBSD, my applications are not working well with sendto e recvfrom, is there any functions that can replace these functions???
Is the structure sockaddr_ll compatible to freeBSD, if not what structure can replace it...

Thank for all, your help:D

RobSeace
09-01-2006, 08:00 PM
sockaddr_ll? No, I'm pretty sure that's a Linux-specific thing, along with the
AF_PACKET sockets that it describes the addresses of...

So, I take it you're trying to port a packet-sniffer of some sort (or, at least something
that sniffs packets for some of its processing)? For portable packet-sniffing, you
really should use libpcap (http://www.tcpdump.org/)... Then, it should work on pretty much any system...
If you don't want to use a higher-level lib like libpcap for whatever reason, then at
least grab the source and read it, to see what method it uses on your OS, and then
you can directly use that method instead, if you prefer...

I'm not sure why you think recvfrom() or sendto() are your problems; based on what
I'm hearing, I think your real problem is actually trying to use AF_PACKET sockets,
which are Linux-only features, on some other OS... But, just to answer your question
here anyway: sure, you can use recvmsg() and sendmsg() to do the same things you
can do with recvfrom()/sendto()... (For connected sockets (eg: TCP), you could also
use plain recv()/send() or read()/write() as well, but you can't use them on unconnected
sockets, like you're presumably using...)

mlampkin
09-16-2006, 02:41 AM
Try using sockaddr_dl instead... thats probably what you are looking for...

An example using it ( via Python -> C calls ) is at:

http://www.developerweb.net/forum/showthread.php?t=4616

As for what Rob said... agreed... I don't understand the relation between the structure(s) in question and regular sends / recvs...


Michael