Re: CuSeeMe 1.0 and Windows 98 II

Brian Godette (bgodette@idcomm.com)
Mon, 29 Jun 1998 19:58:58 -0600


At 08:16 PM 6/29/98 -0500, you wrote:
>On Mon, 29 Jun 1998, Brian Godette wrote:
>> At 04:33 PM 6/29/98 -0600, you wrote:
>> >Windows does not let a programmer specify WHICH IP address to bind to.
>>
>> Ummm, really, guess you better tell that to Microsoft's IIS team, WP, and
>> several other companys.
>
>The problem I've seen is applications don't let you DYNAMICALLY choose
>which interface to bind to. It's easy to bind to a specific interface
>once it's known. That's a problem I had with a little FTP server I wrote
>in C for a class. I wonder if this has anything to do with the
>gethostbyname() problem with the older Cornell versions.
>
>The only videoconferencing program that I know of that lets you
>dynamically choose which interface to bind to is iVisit 2.1b2. They have
>an "IP Selector" option which lets you change the bound interface.
>
>> struct sockaddr_in saddr;
>> memset(&saddr, 0, sizeof(saddr));
>> saddr.sin_family = AF_INET;
>
>Everything up to here is easy enough (though not IPv6 capable).
>
>> saddr.sin_addr.s_addr = bind_ip;
>
>Where does bind_ip come from though? If you use something like

With ERef, if no hostname is defined in reflect.conf then it uses
gethostname() then gethostbyname() then gethostbyaddr() to normalize the
hostent. If one hostname is defined then it check to see if it's an ip
address (inet_addr(hostname)) and if not does gethostbyname() and
gethostbyaddr(). It then attempts to use that as bind_ip, if the first bind
fails bind_ip is set to INADDR_ANY (0.0.0.0), which usually ends up to be
the first defined TCP/IP interface under
HKEY_LOCAL_MACHINE->System->CurrentControlSet->Services->Class->NetTrans.

>gethostbyname(), you can step thru the address pointers I suppose. But
>then again, how do you CHOOSE which one to use? How does a program choose
>which bind_ip to use if there are multiple IPs available and they don't
>ask the user to choose one? Do they just use the first one? If they use
>h_addr in the hostent struct to get the first one, what determines the
>order? It seems like it'd be much easier to throw up an option allowing
>the user to choose which IP to bind to.
>
>Again, this problem never occured when there was only one numerical IP
>address bound to a computer which would be my guess as to why the
>programmers never thought much about it. If I understand it right, it's
>only a problem because each client also acts as a server..sending AND
>receiving data with the IP address embedded within the packets on top of
>the IP address in the header.
>
>--
>streak@ccwf.cc.utexas.edu * Jason Williams -- Austin, Tx. | |
>streak@mail.utexas.edu * University of Texas at Austin | ___ |
>streak@cs.utexas.edu * BS Computer Science \_|_/
>*************** http://ccwf.cc.utexas.edu/~streak/ **************|
>
>