INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

How do you use multiple network ports in vb6?

How do you use multiple network ports in vb6?

(OP)
I recently installed one of my old programs on a clients new computer and noticed it had 4 network ports.
Luckily only one is in use.
I wondered how do you distinguish which port is which in an application?
In Windows 7 you can easily see and set different ip addresses in the ports but there seems no property of winsock to send different signals to different ports.

RE: How do you use multiple network ports in vb6?

If you are talking about outbound TCP connections and sending UDP datagrams, then you don't specify which adapter to use.

The OS uses routing rules such as checking whether one adapter is on the same subnet as the target address, whether a static route has been configured to the target address' network, and if those fail the default gateways for each adapter are tried in turn using routing protocols.

RE: How do you use multiple network ports in vb6?

(OP)
Say I have 4 separate networks, 4 winsocks, one each to use to receive data. 2 are clients, the other 2 are servers.
I presume the servers will automatically connect with the remote clients on the listening address specified in the server winsocks.
When I issue the Winsock.connect (to various different IPs in turn) to a client winsock, to connect to a remote server, will it automatically connect using the first winsock that finds the remote server? How will I know which Winsock Dataarrival Sub to use as these could be continually swapping?

RE: How do you use multiple network ports in vb6?

> How will I know which Winsock Dataarrival Sub to use as these could be continually swapping?

Winsock operates at the session layer interface to the transport layer within the OSI 7 layer model (layers 4 and 5). It has no visibility of (nor does it care about) the network card in use (which resides at the physical layer, layer 1). A Winsock session will remain valid until it is torn down no matter which of multiple network cards (or routes over the LAN/WAN./Internet) the traffic flows.

RE: How do you use multiple network ports in vb6?

(OP)
Thanks, that cleared that up but unfortunately does not appear to be the result I had hoped.
I have started a new thread on a related but different question.

RE: How do you use multiple network ports in vb6?

For a TCP server you normally select one adapter to listen on when you call the Bind method. If you omit this it will only listen on the "first" adapter, where "first" isn't easy to predict, but is most likely the first one in the linked list returned by a GetAdaptersInfo() call.

RE: How do you use multiple network ports in vb6?

Save yourself some grief: stop calling adapters "ports."

RE: How do you use multiple network ports in vb6?

(OP)
Thanks
I presumed the only use you would make of more than 1 adapter is if you wanted to connected to more than one entirely different networks eg local and exclusive internet modem.
Is there any advantage in having them both on the same network router? Eg speed?

RE: How do you use multiple network ports in vb6?

There can be several reasons.

A really important one for servers supporting large numbers of clients is pretty simple:

IP port numbers (both TCP and UDP) are limited to 65536 unique values. Quite a few are reserved ports in each of the two protocols, and the ephemeral port range can be pretty narrow (normally well under 32K values). So to support large numbers of clients or peers you need multiple IP addresses.

Of course Windows Server and other server OSs support multiple IP "virtual adapters" (IP addresses) on each physical adapter. That helps get around the port number limits as well.

Then you get into performance. Physical adapters have finite onboard buffer memory and processing power, which can limit their effective bandwith when handling large numbers of conversations. The raw network may have capacity but the adapter is too busy to use it all.

RE: How do you use multiple network ports in vb6?

(OP)
Thanks - satisfied my curiosity

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close