<p>I changed wording of the quote a bit, so it would match your question.</p>

<blockquote>
  <p>When you connect to a client, you will receive responses on the port
  you just used to connect to that client. The Bitcoin network uses persistent TCP
  connections that remain active so long as both nodes continue running.</p>
</blockquote>

<p><a href="https://bitcoin.stackexchange.com/questions/1413/bitcoin-communication-with-non-standard-ports/1417#1417">Bitcoin communication with non-standard ports</a></p>

<p>For the sake of discussion we can define Server as the side that waits or listens on port 8333 and Client as the side that initiates connection by sending network packet to "server_ip_address":"8333" , the network packet has address of the Client, so Server can send reply back to "client_ip_address":"any_port_reserved_for_client_on_client's_network" . </p>

<p>Bitcoin always reserves 8333 port on workstation to communicate with Bitcoin Network, but usually home router changes the port number in packet when it's on it's way out for the Network Address Translation mechanic (NAT). To overcome NAT and make Bitcoin Client act as Server and accept incoming connections, Port Forwarding or UPnP should be enabled.</p>

CC BY-SA 3.0
2011-11-04T10:19:17.747Z
So you only receive responses to your queries, and you shouldn't expect other clients to send you their queries to port other than 8333?
ThePiachu
CC BY-SA 3.0
2011-11-04T11:50:46.757Z
I edited my answer to clarify things.
Serith
CC BY-SA 3.0
2012-02-26T19:27:51.660Z
I don't think you're answering the question that was asked.  He's asking whether it matters who listens and who connects.  It doesn't, as Gavin's answer says.  Once a connection is made, both sides can send requests and responses through that connection.  Also, Bitcoin doesn't always reserve port 8333; it's configurable by the user with the -port=<port> command line argument.
Chris Moore
CC BY-SA 3.0
2011-11-03T22:09:10.150Z
2011-11-04T11:49:28.927Z
2017-04-13T12:47:36.647Z
Serith
<p>Once the connection is established, the communication is completely symmetric-- either end can ask the other anything.</p>

CC BY-SA 3.0
2011-11-04T17:59:33.330Z
2011-11-04T17:59:33.330Z
gavinandresen
<p>When client A opens a connection to client B, it opens its TCP connection to second client's port 8333. Is this connection solely used for A's queries and B's answers to A's query, or can B also query A using the same connection?</p>

<p>For example, A can ask B for list of known peers using this connection, but can B ask A for the same using the connection A established, or does B need to open a new connection to A's port 8333, exchange version messages, and only then send its queries?</p>

<bitcoin-core><tcp>
Bitcoin client two-way communication
ThePiachu
# Bitcoin client two-way communication

(Asked by: username_0 on 2011-11-03)

When client A opens a connection to client B, it opens its TCP connection to second client's port 8333. Is this connection solely used for A's queries and B's answers to A's query, or can B also query A using the same connection?

For example, A can ask B for list of known peers using this connection, but can B ask A for the same using the connection A established, or does B need to open a new connection to A's port 8333, exchange version messages, and only then send its queries?

**Tags:** bitcoin-core, tcp


---

## 2 answers

### Answer by username_1 on 2011-11-03. Score: 2 | Accepted answer

I changed wording of the quote a bit, so it would match your question.

> When you connect to a client, you will receive responses on the port
> you just used to connect to that client. The Bitcoin network uses persistent TCP
> connections that remain active so long as both nodes continue running.

[Bitcoin communication with non-standard ports](https://bitcoin.stackexchange.com/questions/1413/bitcoin-communication-with-non-standard-ports/1417#1417)

For the sake of discussion we can define Server as the side that waits or listens on port 8333 and Client as the side that initiates connection by sending network packet to "server\_ip\_address":"8333" , the network packet has address of the Client, so Server can send reply back to "client\_ip\_address":"any\_port\_reserved\_for\_client\_on\_client's\_network" .

Bitcoin always reserves 8333 port on workstation to communicate with Bitcoin Network, but usually home router changes the port number in packet when it's on it's way out for the Network Address Translation mechanic (NAT). To overcome NAT and make Bitcoin Client act as Server and accept incoming connections, Port Forwarding or UPnP should be enabled.

> **Comments:**
> **username_0**: So you only receive responses to your queries, and you shouldn't expect other clients to send you their queries to port other than 8333?  
> **username_1**: I edited my answer to clarify things.  
> **username_2**: I don't think you're answering the question that was asked.  He's asking whether it matters who listens and who connects.  It doesn't, as Gavin's answer says.  Once a connection is made, both sides can send requests and responses through that connection.  Also, Bitcoin doesn't always reserve port 8333; it's configurable by the user with the -port=<port> command line argument.  

---

### Answer by username_3 on 2011-11-04. Score: 7

Once the connection is established, the communication is completely symmetric-- either end can ask the other anything.


---

