RELATED POST
The post here In UNIX forum describes
The server will keep on listeninig on a port number.
The server will accept a clients
connect()
request usingaccept()
. As soon as the server accepts the client request, the kernel allocates a random port number for the server for furthersend()
andreceive()
, since the same port number on the server can't be used for sending as well as listening, and the previous port is still listening for new connections
QUESTION
I have a server application S
which is constantly listening on port 18333 (this is actually bitcoind
testnet
). When another client node C
connects with it on say 53446 (random port). According to the above post, S
will be able to send/receive data of 'C' only from port 53446.
But when I run a bitcoind
testnet
. This perfectly communicates with other node with only one socket connection in port 18333 without need for another for sending/receiving. Below is snippet and I even verified this
bitcoin-cli -testnet -rpcport=16591 -datadir=/home/user/mytest/1/
{
"id": 1,
"addr": "178.32.61.149:18333"
}
Can anyone help me understand what is the right working in TCP socket connection?