From owner-freebsd-questions@FreeBSD.ORG Wed Nov 14 23:15:31 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 979D916A417 for ; Wed, 14 Nov 2007 23:15:31 +0000 (UTC) (envelope-from derek@computinginnovations.com) Received: from betty.computinginnovations.com (mail.computinginnovations.com [64.81.227.250]) by mx1.freebsd.org (Postfix) with ESMTP id 3DED913C478 for ; Wed, 14 Nov 2007 23:15:31 +0000 (UTC) (envelope-from derek@computinginnovations.com) Received: from p28.computinginnovations.com (dhcp-10-20-30-100.computinginnovations.com [10.20.30.100]) (authenticated bits=0) by betty.computinginnovations.com (8.13.8/8.13.8) with ESMTP id lAENFCOo096044; Wed, 14 Nov 2007 17:15:13 -0600 (CST) (envelope-from derek@computinginnovations.com) Message-Id: <6.0.0.22.2.20071114165954.024c5d90@mail.computinginnovations.com> X-Sender: derek@mail.computinginnovations.com X-Mailer: QUALCOMM Windows Eudora Version 6.0.0.22 Date: Wed, 14 Nov 2007 17:14:56 -0600 To: "Andrew Falanga" , "User Questions" From: Derek Ragona In-Reply-To: <340a29540711141421tda33970q79f85533fb5ba725@mail.gmail.com > References: <340a29540711141421tda33970q79f85533fb5ba725@mail.gmail.com> Mime-Version: 1.0 X-ComputingInnovations-MailScanner-Information: Please contact the ISP for more information X-ComputingInnovations-MailScanner: Found to be clean X-ComputingInnovations-MailScanner-From: derek@computinginnovations.com X-Spam-Status: No Content-Type: text/plain; charset="us-ascii"; format=flowed X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Re: Socket programming question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Nov 2007 23:15:31 -0000 At 04:21 PM 11/14/2007, Andrew Falanga wrote: >Hi, > >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? > >Thanks, >Andy Andy, 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. -Derek -- 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.