如何连接到互联网上的静态或本地IP [英] how connect to static or local ips on internet

查看:114
本文介绍了如何连接到互联网上的静态或本地IP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我正在开发一个套接字程序...
所以我想在1)服务器端使用有效的ip运行我的程序
2)客户端我的其他程序可能正在vps上运行...因此在该vps中我的程序通过本地ip地址(静态)连接到Internet,但是任何一个自己的vps都有效...所以
我的问题是:
1)在我的客户端中,我可以使用有效的端口进行监听和发送吗?
2)我想将服务器连接到我的客户端程序,我应该首先连接到vps ...以及如何使用vps ip访问那里的本地ip?
3)您有关于它的所有想法分享
谢谢

hi every body
i am working on a socket program...
so i wanna in 1)server side i run my program with valid ip
2)client side my other program is run maybe on a vps...so in that vps probebly my program connect to internet with local ip address(static)but either own vps has valid...so
my questions is :
1)in my client side can i listen to and send with port of valid??
2)i wanna connect with my server to my client program i should first connect to vps...and how i can access with vps ip to local ip in there??
3)every idea you have about it share
thank you

推荐答案

1)是的,你可以
2)您需要连接到VPS的公共IP.您或ISP需要设置NAT(或端口转发)以将服务器的数据包转发到客户端(即,转发到VPS的专用IP).
1) Yes you can
2) You need to connect to VPS''s public IP. Either you or the ISP needs to set up NAT (or port forwarding) to forward the server''s packets to the client (ie. to the VPS''s private IP).


这篇关于如何连接到互联网上的静态或本地IP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆