For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > July 2006 > Which network?









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 Which network?
Martin

2006-07-02, 7:55 am

My VB6 app runs on a dual-homed machine (two NICS, two completely
different networks). I'm exchanging data with other computers on both
networks (via Winsockets).

In the case where my program is the server-side of the connection, is
there any way that I can tell which network the connection is on?

For example, if I'm running on a box with addresses: 10.20.30.40 and
192.168.100.123 and some data shows up in my Winsock_DataArrival
event, how can I tell which network it came in on?


Martin

2006-07-02, 6:55 pm

On Sun, 02 Jul 2006 05:47:23 -0700, Martin <martinvalley@comcast.net>
wrote:

>My VB6 app runs on a dual-homed machine (two NICS, two completely
>different networks). I'm exchanging data with other computers on both
>networks (via Winsockets).
>
>In the case where my program is the server-side of the connection, is
>there any way that I can tell which network the connection is on?
>
>For example, if I'm running on a box with addresses: 10.20.30.40 and
>192.168.100.123 and some data shows up in my Winsock_DataArrival
>event, how can I tell which network it came in on?
>


I've found that if I check the Winsock.RemoteHostIP property, it tells
me the IP address of the computer that sent the data. I can thus see
which network was used.

But, I noticed something strange. When I look at the Winsock.LocalIP
property, it shows the address of the "other" NIC ?!

Here's the actual data (on the server-side unit):
NIC #1: 192.168.200.140
NIC #2: 192.168.201.140

When I connect from my laptop (192.168.200.22), the server-side unit
shows:
Winsock.RemoteHostIP = 192.168.200.22
Winsock.LocalIP = 192.168.201.140
--- shouldn't this be: 192.168.200.140 ?

Comments?

David Kerber

2006-07-03, 7:55 am

In article <56ofa29jmfjt1h2tqjq1279sv9h904uj6i@4ax.com>,
martinvalley@comcast.net says...

....

>
> But, I noticed something strange. When I look at the Winsock.LocalIP
> property, it shows the address of the "other" NIC ?!
>
> Here's the actual data (on the server-side unit):
> NIC #1: 192.168.200.140
> NIC #2: 192.168.201.140
>
> When I connect from my laptop (192.168.200.22), the server-side unit
> shows:
> Winsock.RemoteHostIP = 192.168.200.22
> Winsock.LocalIP = 192.168.201.140
> --- shouldn't this be: 192.168.200.140 ?


What is your subnet mask set to for each of those cards? Is it set so
that these IP's belong to different subnets?


--
Remove the ns_ from if replying by e-mail (but keep posts in the
newsgroups if possible).
Martin

2006-07-03, 6:56 pm

Xref: TK2MSFTNGP01.phx.gbl microsoft.public.vb.general.discussion:596207

On Mon, 3 Jul 2006 08:11:58 -0400, David Kerber
<ns_dkerber@ns_WarrenRogersAssociates.com> wrote:

>In article <56ofa29jmfjt1h2tqjq1279sv9h904uj6i@4ax.com>,
>martinvalley@comcast.net says...
>
>...
>
>
>What is your subnet mask set to for each of those cards? Is it set so
>that these IP's belong to different subnets?


The subnet mask is set to 255.255.255.0 on both cards.
Jim Mack

2006-07-03, 6:56 pm

Martin wrote:
> On Mon, 3 Jul 2006 08:11:58 -0400, David Kerber
> <ns_dkerber@ns_WarrenRogersAssociates.com> wrote:
>=20
>=20
> The subnet mask is set to 255.255.255.0 on both cards.



What do you see if you do a "netstat -nr" from the command line? This =
will tell you how packets travel on the two segments.

--=20

Jim Mack
MicroDexterity Inc
www.microdexterity.com
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com