简体   繁体   中英

TCP/IP Socket Programming Static Web IP between Dynamic IP

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 XXXX 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 (XXXX) 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 .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM