SFML community forums
Help => Network => Topic started by: diego997 on December 12, 2012, 07:34:43 pm
-
Hi, I have already finished my simple comunicator, but it works only when two clients are connected together by using for example Hamachi. Is it possible to comunicate somehow without such programs ? In other words how to send and receive informations between two clients if they are not connected in LAN ?
Greetings :)
-
For communicating over the internet you need to configure your router. Normally the router blocks every request from outside so no hacker shall get into your network. If you want to run a server in your intranet you need to open the ports at your router. It's called "Port Forwarding" and when searching it with google you will find a lot of tutorials.
As soon as everything is configured well clients can connect to your server with your global Ip address (the sf::IpAddress-class has a member function for retrieving it).
-
cool thank you for answer I am going to read about this now :D
P.S one more question, what about if I want to send massage to the clinet he also needs to configurate a router ? It would have no sence ;p
-
No, you just have to configure the router of the server. As soon as the tcp-connection is built both can send and receive. If you use udp-packets I am not sure how it exactly works because I never used them but it should work the same.