0
votes

I am confused about TCP/IP Socket Programming. I know the internet protocols but in theory...

I am explaining my problem (what i need )

I have a server working on X.X.X.X IP Adress. And it always listens to Y PORT.

When i want to connect that server on MY PC, i have no problem because i wrote the ip adress (X.X.X.X) and the port (Y) and my PC connects..

When i connect to server server keeps my ip adress and my local ip adress.. After that connection is end.

Here is my problem starting... As i sad my server knows my local PC informations. How can i connect to my local PC on server my web server and sent TCP or UDP packets ? I did port forwarding on my modem but i dont want it. When i did port forwarding there is no problem but i dont want it ...

Thanks for replies and sorry for my engislih if i have mistakes .

1

1 Answers

0
votes

If a router/NAT sits between your server and an outside client, you MUST use port forwarding on the router. The outside client will NOT be connecting to your server's private LAN IP/Port directly, it will be connecting to the router's public WAN IP/Port instead. So the router needs to know to forward inbound packets to that IP/Port to the server's private LAN IP/Port.

A client running on your local PC is able to connect to the server because they are both on the same LAN side of the router, so the connection is direct and does not go through the router's WAN. That is not the case for clients that are on the WAN side of the router.