*BSD News Article 25216


Return to BSD News archive

Xref: sserve comp.unix.bsd:13146 comp.protocols.tcp-ip:26616
Newsgroups: comp.unix.bsd,comp.protocols.tcp-ip
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!sgiblab!swrinde!emory!europa.eng.gtefsd.com!uunet!nevada.edu!jimi!ftlofaro
From: ftlofaro@unlv.edu (Frank Lofaro)
Subject: Re: virtual hosts based on ip address?
Message-ID: <1993Dec21.031825.3624@unlv.edu>
Sender: news@unlv.edu (News User)
Organization: University of Nevada, Las Vegas
References: <2eptfr$1lr@zip.eecs.umich.edu> <2f4ucf$l1u@zip.eecs.umich.edu>
Date: Tue, 21 Dec 93 03:18:25 GMT
Lines: 17

In article <2f4ucf$l1u@zip.eecs.umich.edu> zeeff@dip.eecs.umich.edu (John Zeeff) writes:
>So the remaining issue is how does one find the address that the originator
>of the connection used to come in on (ie, what interface is being used)
>when one is using the ifconfig alias command.
>
>So similar to getpeername(), but for the local side.
>
>I've haven't looked into it yet, but it seems that that information must be
>available somewhere.
>

I think getsockname() is what you are looking for.
Same format as getpeername, but returns info for the local side, not the remote.

I am not sure if it will necessarily give the right interface the other side 
used to connect (it should, IHMO, but, try it first :)