Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Can't establish UDP or TCP connection via internet, but LAN work well. (1.6)  (Read 5512 times)

0 Members and 1 Guest are viewing this topic.

t.o.m.y

  • Newbie
  • *
  • Posts: 2
    • View Profile
Hello together,

the title explain my problem.

But some details:
  • I simply use the code from the tutorial and over LAN everything is working fine.
  • The UDP packets over internet never recive.
  • With TCP i can't create a connection -> timeout (default).
  • I use Fedora17 and i have already tryed to disable the firewall -> nothing.
  • I don't have a hardware router.

Has anybody an idea?

Greets

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Quote from: t.o.m.y
  • I don't have a hardware router.
What do you mean by that? ???
How do you connect the to the internet then?
What ports are you trying to use?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

t.o.m.y

  • Newbie
  • *
  • Posts: 2
    • View Profile
Ahmmm, excuse me. I mean: no hardware router with firewall. I use a simple modem.

I have tried port 4567, 50000 & 50001.

Greets

firefly2442

  • Newbie
  • *
  • Posts: 23
    • View Profile
Can you ping the IP address or hostname that you're trying to connect to?  I would try that first.  If that works, then it narrows it down a little bit...

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
You need to understand how your local LAN connects to the internet. Because there aren't enough IP addresses for the amount of computers on this planet if you just use IPv4 the clever network engineers thought of something called NAT. With NAT you can have as many computers (this is still limited though) on your local network as you want, but they all use the same internet IP address.

When you try to send data from one computer to another computer over the internet you address both endpoints by their internet IP address (I hope... if you use your local address for this then you are doing something wrong). For the data to get from your gateway/router to the correct computer on your local network you need to tell it where to send data you are expecting. You have to do this for any data that is incoming. Gateways/Routers are smart and remember that if your computer sends data out it also awaits a response. However if you don't send any data out and expect data to be received you must set this in your gateway/router configuration (normally over a web browser in standard home/office routers).

This is commonly known as port forwarding and it is something you should know how to do if you play older online games. It has nothing to do with a firewall in most cases, unless you have a strict firewall that by default denies any traffic from passing until it is configured but this is almost never the case.

What you have to do is forward the ports that you use in your SFML application in your gateway/router to the computer you are running the application on. Normally this is done per protocol, so either TCP or UDP but not both at the same time.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).