PDA

Click to See Complete Forum and Search --> : [RESOLVED] Remotehost and ports questions


dlern
Jan 27th, 2006, 04:55 PM
I have some general questions about setting up Remotehost and ports.

1) What is the need for both? Is it analogous to a userID and password? As in you need to know both the remotehost name (or IP) and the port to be part of a paticular winsock network?

2) Can you arbitrailary chose any port number?

3) If you are going to set up more than one connection port using the same host computer, (eg, one port for sending small data message, a different port for transfering large files (greater than 1Mb) and "chunking" them) should the port numbers differ by a certain amount or can they be one number apart? (i.e 7100,7200 vs 6125,6126)

4) Alternatively, if your are setting up multiple servers on the same lan, should the port numbers differ by any amount? (similar to question 3)

Specifically, I am setting up a number of lab networks in our school building. (we have have 6 labs, 30 computers each). Each labe network is to operate independantly of the other labs (one server per lab, 30 clients) All the computers are connected to the same LAN. Could I use the same port for all the clients and just specify which remotehost they should connect to (ie 180 computers "porting" to port number 6789, 30 contecting to remotehost "Lab-1", 30 connecting to "Lab-2", etc.)? Is there a problem if 6 servers are all listening for the same port?

All input is appreciated.

Rob123
Feb 18th, 2006, 10:34 AM
1) You don't need a userid/password to connect through winsocks, but you can code one in. Yes, you need to know both the IP and the port to connect to another computer.

2) Yes, aslong as that port isn't in use by another program on your comp

3) There is no need to space the port numbers, it's just a 'label' for the computer to identify each connection

4) As long as you're not attempting to use one port for two connections on one computer

I'm assuming the servers don't connect to eachother. Each server could use say, port 4000 to listen on. When a connection comes through, the first winsock can divert the call to another port (Any port can do), then continue listening on port 4000 for the other 29 computers in the lab.

If you want, I can post some code to run a server with multiple connections, with only 1 port needed

the182guy
Feb 18th, 2006, 10:48 AM
1) You don't need a userid/password to connect through winsocks, but you can code one in. Yes, you need to know both the IP and the port to connect to another computer.

You dont necessarily need an IP address to make a connection, if its over a Local Area Network, you can just use the computer name to connect to, or domain name (the domain name works with networks and the internet).

You could edit your windows HOSTS file to set it up so www.bob.com actually connects to one of your network nodes...such as a server (without actually having to buy the domain name bob.com). If you did this, you could use this domain name to connect to through the socket

dlern
Feb 20th, 2006, 03:32 AM
1) You don't need a userid/password to connect through winsocks, but you can code one in. Yes, you need to know both the IP and the port to connect to another computer.

2) Yes, aslong as that port isn't in use by another program on your comp

3) There is no need to space the port numbers, it's just a 'label' for the computer to identify each connection

4) As long as you're not attempting to use one port for two connections on one computer

I'm assuming the servers don't connect to eachother. Each server could use say, port 4000 to listen on. When a connection comes through, the first winsock can divert the call to another port (Any port can do), then continue listening on port 4000 for the other 29 computers in the lab.

If you want, I can post some code to run a server with multiple connections, with only 1 port needed
Thanks for the offer, but I have the multple connections coding working fine. My main concern was if I needed to set up any specific port numbers or sapcing between port numbers, and realize any port will do (provided it does not interfere with other ports on the network e.g. 80 being an internet connection port).

Is there a way to list what ports are being used on the network (ie using a dos net commnad?)

Glad to see I can use the same port for all servers. I see what you mean by using the same port on one computer, I tried that as an experiment , and an error message comes up stating theat port is already in use. Also, I had previously chose to use the hostname instead of the ip number.

Alos what did you mean by winsock can divert the call to another port ?

the182guy
Feb 20th, 2006, 07:54 AM
Theres approx 65,000 ports available, and approx the first 10,000 are used by system apps and other third party software, so if you use a port around 10,000 or higher its highly unlikely it will conflict with another app