Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does TCP use another port for sending data?

I heard that for TCP connection, server will listen on 1 port, and use another port for sending data.

For example, web server listen on port 80. Whenever client connects to it, this server will use another port (say 9999) to send data (web content) to client. If multiple clients connect to it, does this server create multiple "another ports" to send data back ?

And does the client uses 2 ports (listening port and sending-data port) as the server does ?

Am I right? I heard many people said that and I can't find any good books or articles about this

Please explain

like image 536
onmyway133 Avatar asked Apr 02 '13 10:04

onmyway133


People also ask

What port does TCP use?

TCP Ports 80 and 443 Arguably the single most famous port on the Internet, TCP port 80 is the default that HyperText Transfer Protocol Web servers listen on for Web browser requests. Port 443 is the default for secure HTTP.

Can TCP send and receive on same port?

A TCP connection has two ends and permits communication in both directions. Each end's sending port is the other end's receiving port. That is always the case. If you're asking if each end's sending port can be the same as the other end's receiving port, the answer is yes.

Do TCP and UDP use same ports?

TCP and UDP ports are not related to each other. TCP ports are interpreted by the TCP stack, while the UDP stack interprets UDP ports. Ports are a way of multiplexing the connection so that multiple devices can connect to a node.

How do you transfer data to a TCP port?

The TCP Open Connection node opens a connection to the server at the port and address you specify. The address must match the IP address of the server, and the port you specify on the client must match the port you specify on the server. TCP Write nodes write data to the specified port and send commands to the server.


1 Answers

I heard that for TCP connection, server will listen on 1 port, and use another port for sending data.

No. The same port is used for both listening and for accepted connections, and the same connection is normally used for both sending and receiving. TCP connections are bidirectional. FTP is an exception to this, as it uses two connections: one for commands and one for data.

For example, web server listen on port 80. Whenever client connects to it, this server will use another port (say 9999) to send data (web content) to client.

No.

If multiple clients connect to it, does this server create multiple "another ports" to send data back ?

No.

And does the client uses 2 ports (listening port and sending-data port) as the server does ?

No.

Am I right?

No.

I heard many people said that

They were all wrong.

and I can't find any good books or articles about this

There aren't any. Only a very bad book or article would say any such thing.

like image 92
user207421 Avatar answered Oct 06 '22 01:10

user207421