c# - TcpListener and TcpClient sharing local port -
i have 2 instances of same application, on different machines, should talk each other, no 1 typical server or client. both instances of application has tcplistener, local port = 8000. one application instance (call "a") creates tcpclient. now, client can't have local port = 8000, or constructor throws socket exception "only 1 usage of each socket address (protocol/network address/port) permitted" . so, create first client random local port, , run connect() connect other application instance "b". "b" accepts connection using tcplistener.accepttcpclient(), returns tcpclient can used communicate "a". though, tcpclient has same ip , port tcplistener!? how possible, when not use same port when created tcpclient manually on "a"? them use same port listener, on both machines... so, how can create tcpclient on "a" same port tcplistener? i think might not understand address port client server archi...