Re: [question][code]gethostbyaddr....ports...

From: Daniel Koepke (dkoepke@california.com)
Date: 01/08/99


Invincibill wrote:
>
> is there anyway to see which port a player is connected FROM?  i
> want to put it in my do_users function. i couldnt find any function
> in socket.h to do that.

Well, the accept() call modifies a sockaddr_in structure, which has
the member sin_port.  Although, IMHO, it's rather pointless to
display it.  Anyway, you'd do:

  d->port = ntohs(peer.sin_port);

where peer is a variable of type "struct sockaddr_in", previously
passed to accept() as,

  accept(..., (struct sockaddr *) &peer, ...)

-dak


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST