Problem with Multi-homed Win32 PC's

Uwe Reisewitz (uwer@nk.anzeiger.net)
Tue, 14 Jul 1998 20:59:54 +0200


This is a multi-part message in MIME format.

------=_NextPart_000_00B1_01BDAF6A.5A0F7AC0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,
since my email to cu-seeme-bugs@cornell.edu returned with a DNS error I =
thought I try the mailing list next...

Please accept my apologies in advance if this arrives now for the 3rd =
time!

I've encountered a problem with CU-SeeMe version 1.0 on Windows NT. This =
problem should be present at least in all Win32 operating systems using =
the MS-TCP implementation:
=20
CU-SeeMe detects the IP-address it uses to connect to the reflector =
server when it starts (the address is shown in the status bar). This =
might lead to wrong addresses transmitted in multi-homed PC's (those =
having more than one IP-address). My machine for example has a fixed =
IP-address assigned to the network card but gets dynamic addresses when =
connection to the Internet via my ISDN-card.
=20
Since I made the same mistake in an IP-software myself, I would like to =
present a solution for the problem:
=20
It seems to be impossible to decide which IP-address to use as the =
source address in a multi-homed Win32-environment. The correct =
IP-address depends on the server you connect and is determined by the =
MS-IP-stack.
=20
The solution is quite simple:
Don't try to know your local address before you're connected! Simply =
connect() to the Reflector-server. After a successful connect, do the =
following:

-------------------------------------------------------------------------=
-------

struct sockaddr_in LocalIP;

int AddrLen =3D sizeof(struct sockaddr_in);

*status =3D getsockname(ConnectedSocket, (struct sockaddr PTR *) =
&LocalIP, &AddrLen);

if (*status =3D=3D 0)=20

MyLocalIPAdr =3D LocalIP.sin_addr.s_addr;

-------------------------------------------------------------------------=
-------
This works reliable on all MS-implementations.
=20
Since I need this fix to run CU-SeeMe on my system, I hope I could be of =
some assistance...
=20
Thanks in advance for fixing this..
=20
Regards
=20
Uwe
=20

------=_NextPart_000_00B1_01BDAF6A.5A0F7AC0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">

Hi,
since my email = to cu-seeme-bugs@cornell.edu = returned=20 with a DNS error I thought I try the mailing list next...
 
Please accept my apologies in advance if this = arrives now for=20 the 3rd time!
 
I've encountered a problem with = CU-SeeMe version=20 1.0 on Windows NT. This problem should be present at least in all Win32=20 operating systems using the MS-TCP implementation:
 
CU-SeeMe detects the IP-address it = uses to=20 connect to the reflector server when it starts (the address is shown in = the=20 status bar). This might lead to wrong addresses transmitted in = multi-homed PC's=20 (those having more than one IP-address). My machine for example has a = fixed=20 IP-address assigned to the network card but gets dynamic addresses when=20 connection to the Internet via my ISDN-card.
 
Since I made the same mistake in an = IP-software=20 myself, I would like to present a solution for the problem:
 
It seems to be impossible to decide = which=20 IP-address to use as the source address in a multi-homed = Win32-environment. The=20 correct IP-address depends on the server you connect and is determined = by the=20 MS-IP-stack.
 
The solution is quite simple:
Don't try to know your local address before you're = connected!=20 Simply connect() to the Reflector-server. After a successful connect, do = the=20 following:

struct sockaddr_in LocalIP;

int AddrLen =3D sizeof(struct sockaddr_in);

*status =3D getsockname(ConnectedSocket, (struct sockaddr PTR *) = &LocalIP,=20 &AddrLen);

if (*status =3D=3D 0)

    MyLocalIPAdr =3D = LocalIP.sin_addr.s_addr;


This works reliable on all MS-implementations.
 
Since I need this fix to run CU-SeeMe on my system, = I hope I=20 could be of some assistance...
 
Thanks in advance for fixing this..
 
Regards
 
Uwe
 
 
------=_NextPart_000_00B1_01BDAF6A.5A0F7AC0--