开发者

Simple Network chat in Java

开发者 https://www.devze.com 2023-04-02 15:12 出处:网络
just had a question to a simple chat p开发者_C百科rogram i wrote in java. The program uses TCP to transmit simple message strings back and forth from Server/Client. And it works on all the computers o

just had a question to a simple chat p开发者_C百科rogram i wrote in java. The program uses TCP to transmit simple message strings back and forth from Server/Client. And it works on all the computers on my Network. But when i sent it to a friend of mine to see if it worked from his computer it did not. So my question is: Would i need to add some specific code to allow messages from other comps from outside my network to be recieved? or is it some kind of Firewall that is preventing this?


Probably a firewall or a router.

Firewall: port is not opened.

Router: message are not forwarded to the machine which hosts your application.

Or your application is using the internal IP and not the IP from the internet (which has to be forwarded to your internal ip)


If you don't specify anything special in the code for computers that's not on the internal network, then it won't handle them differently. It won't handle the connections differently by itself. I'd check your(or his) router and open any ports that you use.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号