Socket programming question
derek at computinginnovations.com
Wed Nov 14 15:15:31 PST 2007
At 04:21 PM 11/14/2007, Andrew Falanga wrote:
>My question has to do with how someone would find out if a call to socket(2)
>actually produced a socket. I know that the API works, I've programmed with
>it many times, but is there a way to find out if 's' returned by socket(2)
>is actually valid in whatever kernel structure it is stored? I understand
>that I may have the process entirely mixed up. But it seems to me that the
>socket is somehow known to the kernel and I should be able to query the
>kernel somehow and discover if it is valid.
>Let me know if my question doesn't make sense as worded and I'll try to
>explain myself better. Another question related to this one, would someone
>in this list know where the source code is, in the system source tree, for
>the select call?
It's been a while since I did socket programing, but the easiest test is to
use a client application to contact the server side socket. Just be sure
if you want to connect from another host you set the domain correctly in
your socket call for a local socket on the same host or an internet socket
to contact from another host.
With internet sockets, these get added to the TCP stack, and their are
kernel structures created too I'm sure, but I have no idea how to find
those. Netstat will show sockets in use though.
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.
More information about the freebsd-questions