tags:

views:

34

answers:

2

if I telnet two different servers at the same port from my pc, would one finish until the other one's done? does the outgoing port only allow one outgoing connection at a time?

+2  A: 

They are separate and are distinguished by your local TCP port number, which is different for each outgoing connection.

http://www.tcpipguide.com/free/t%5FTCPIPClientEphemeralPortsandClientServerApplicatio.htm

servers respond to clients; they do not initiate contact with them. Thus, the client doesn't need to use a reserved port number. ... To know where to send the reply, the server must know the port number the client is using. This is supplied by the client as the Source Port in the request, and then used by the server as the destination port to send the reply. Client processes don't use well-known or registered ports. Instead, each client process is assigned a temporary port number for its use. This is commonly called an ephemeral port number.

Joe Koberg
so if I say telnet xxx.xx.xxx.xxx 80, the actual local tcp port number will be different from 80?
That's correct. You specify only the destination to `telnet`. Your operating system chooses a random outbound port for you, and your source address comes from your network interface.
Joe Koberg
A: 

There is a difference between the source and destination ports. The remote servers may be using the same port but they are different destinations host1:80 host2:80.

Each connection will use a different source address localhost:random_port.

A tcpdump or wireshark capture of the wire traffic will show the TCP network packets tagged with both the source and destination addresses and ports so that the network traffic has a return path.

Mark Carey
are you saying that the the outgoing port will be different from the chosen one, in fact random?
so in fact host1:80 and host2:80 will not effect each other, right?
you have no control over the local outgoing port. the traffic to the remote hosts will not effect each other as they are each sent on a different outbound port. src: localhost:34567 dst: host1:80; src localhost:34568 dst: host2:80;
Mark Carey
The link from Joe below linked to another page with even more detail on the subject: http://www.tcpipguide.com/free/t_TCPIPClientEphemeralPortsandClientServerApplicatio.htm
Mark Carey
is there a limitation on how many outgoing connections I can create? hundreds? thousands? unlimited?
this limit is set in the OS and can be configurable depending on the platform. also there is a hard limit on the number of tcp ports on a system: 65535. The ports opened for outbound connections are temporary and only used for the life of the connection.
Mark Carey