-5

Okay so I have a tcp running on port 1302. I've port forwarded the servers IP on my router. But how would the client and server send messages to each other... Wouldn't the client have to port forward too. If so, is there any way around this?

stelioslogothetis
  • 9,371
  • 3
  • 28
  • 53
  • Take a step back and imagine you're someone else, reading this question for the first time. Would you understand what the OP is talking about? – stelioslogothetis Jun 19 '17 at 12:31
  • 1
    I really don't understand. TCP running on port 1302 means what? Where do you have the server, where do you have the client? Are you trying to communicate through the internet or on the local network? It is important to give enough details. Generally speaking if you have "real client-server" communication the client communicates with the server and the server sends back responses, so there is no need for port forwarding clients. – Artholl Jun 19 '17 at 12:36
  • Portforwarding is needed when receiving an incoming connection. **(client)** If your client is behind a firewall, it will initiate a connection thru, your firewall knows where the client is an keeps track of both sides. **(server)** Your server will wait until a client initiates a connection. If your client connects from the internet it will reach your firewall/router first, if you didn't portforward a port, your router doesn't know what to do with it and will reject the connection request. – Jeroen van Langen Jun 19 '17 at 12:43

1 Answers1

0

I assume you have a server in local network (i.e. without global IP-address) and you set port-forwarding on your router to have clients sending message to your app which is running on the server on port 1302, right? If so, clients don't need to set their port-forwarding cause it is done automatically by their local provider network. It is typical: server (listener of income messages) without global IP needs port-forwarding but client (who is first to send message) doesn't need port-forwarding.

tech_tych
  • 26
  • 1
  • 4