We have TCP socket connection, from my computer to remote address.
Please, clarify me the next points:
When socket TCP connection is done, the port on client is opened, and also the port on server is opened ?
I want to understand where sockets keep the data when we write something to socket ? We have two same files on server and client ? Or data stored in RAM memory ?
If data are stored in files, can I found files on linux, especially on ubuntu 18.04 ?
- When socket TCP connection is done, the port on client is opened, and also the port on server is opened ?
Yes.
- I want to understand where sockets keep the data when we write something to socket ? We have two same files on server and client ? Or data stored in RAM memory ?
You cannot have the same file on server and client unless they are both on the same machine. But even if they are, the entire data is kept in memory per socket: one buffer for incoming data and one buffer for outgoing. When new data comes the OS buffers it until the app calls .read(). Note that this is an implementation detail.
- If data are stored in files, can I found files on linux, especially on ubuntu 18.04 ?
It is not in files.