如果客户端和服务器在不同的网络上,那么他们可以使用套接字编程相互通信? [英] if client and server are on different network then they can communicate with each other using socket programming?

查看:90
本文介绍了如果客户端和服务器在不同的网络上,那么他们可以使用套接字编程相互通信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在套接字编程客户端和服务器可以相互通信,如果两者都在不同的网络位置..像一个skype信使..

例如我只想发送你好字符串来自客户端并在服务器上收到它然后在回复客户端服务器收到您的消息后..

i want to know in socket programming client and Server can communicate with each other if both on different network place .. like a skype messenger ..
e.g i just want to send "hello string " from clients and recieve its on server then after response back to clients that "server recieved your message" ..

推荐答案

要向某人发送消息,您需要能够要到达目的地地址,如果您在不同的本地网络之间发送,而您之间没有桥接器/路由器则无法发送。



To看看是否可以尝试:
To send a message to someone you need to be able to reach the destination address, if you are sending between different local networks and you don't have a bridge/router in between then you can't send.

To see if it is possible try :
c:\>ping <your destination="" ip=""></your>



如果它不起作用则无法发送。


If it does not work then you can't send.


这与您的编码无关,而且与您的网络配置和防火墙有关。如果您无法在客户端和服务器之间执行ping操作,则这两个点之间没有打开的路由。如果这是您的网络,则需要检查防火墙设置以及路由表。如果这是其他人的网络,那么您需要向他们寻求帮助。
This has nothing to do with your coding, and everything to do with your network configuration and firewall. If you cannot ping between client and server then there is no open route between those two points. If this is your network then you need to check the firewall settings and also the routing tables. If this is someone else's network then you need to ask them for assistance.


这篇关于如果客户端和服务器在不同的网络上,那么他们可以使用套接字编程相互通信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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