Unix Programming - Re: How to get the socket file descriptor which is connecting on

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > June 2007 > Re: How to get the socket file descriptor which is connecting on





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: How to get the socket file descriptor which is connecting on
Rainer Temme

2007-06-22, 7:23 am

liusaipu@gmail.com wrote:

> In my C code, I know a specified port on which the local process is
> connecting to another peer, but I want to know what's its socket file
> descriptor, would you tell me how to implement this?


Have a look at the getsockname() and getpeername()
functions ... these two, and a loop over all your
descriptors should be able to do what you want.

Rainer


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com