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

Author Topic: Noob network problem...  (Read 2295 times)

0 Members and 1 Guest are viewing this topic.

Chris Jozwiak

  • Newbie
  • *
  • Posts: 48
    • View Profile
    • Blog
    • Email
Noob network problem...
« on: May 07, 2017, 06:04:34 pm »
Afternoon or it will be when I'm done writing this post.
I have issues. Many many issues. My program compiles fine, both of them rather. My troubles ensue when I have my server and client open. Nothing is displayed and nothing happens. I am utilizing the basic code from the official networking tutorial, all that has changed is the port.

Code is the same as tutorial pretty much but:
Server:
(click to show/hide)


Client:
(click to show/hide)

The consoles display a blinking cursor and nothing else. I'm a noob with network programming. Enabled the port in my firewall, still nothing.

Edit 1:00 PM :
Server binds to port properly but client is unable to connect to the port. I feel as if it's something with my network.
I am running ubuntu 16.04. Not sure if something blocking something Fajsg;jaksjfg;lkajskrlgjlka. Yep.
« Last Edit: May 07, 2017, 07:03:51 pm by Sianide »
Noob C++ Programmer.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10226
    • View Profile
    • development blog
    • Email
Re: Noob network problem...
« Reply #1 on: May 07, 2017, 07:23:00 pm »
And your server and client run on the same device (i.e. your PC)?
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
——————————————————————
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/

Chris Jozwiak

  • Newbie
  • *
  • Posts: 48
    • View Profile
    • Blog
    • Email
Re: Noob network problem...
« Reply #2 on: May 07, 2017, 07:26:09 pm »
And your server and client run on the same device (i.e. your PC)?

Yes, this is correct. The server listens properly I made some changes to the error blocks. The server now outputs to the console "Listening on port 20000" and the code is after the binding section in said server code. So it opens the port properly. The problem is in the client or my PC.
Noob C++ Programmer.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10226
    • View Profile
    • development blog
    • Email
Re: Noob network problem...
« Reply #3 on: May 07, 2017, 07:34:31 pm »
Since you don't specify an IP for the server to listen to, it will use sf::IpAddress::Any that is 0.0.0.0.
But your client tries to contact localhost, i.e. 127.0.0.1.

You need to either make the client connect to the local IP address or change the host to listen on localhost.
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
——————————————————————
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/

Chris Jozwiak

  • Newbie
  • *
  • Posts: 48
    • View Profile
    • Blog
    • Email
Re: Noob network problem...
« Reply #4 on: May 07, 2017, 07:38:25 pm »
In the above code I changed port 50003 to 20000 and the client is connecting to 127.0.0.1 on 20000. It times out after some time. How would I have the server listen to 127.0.0.1:20000?
Noob C++ Programmer.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10226
    • View Profile
    • development blog
    • Email
Re: Noob network problem...
« Reply #5 on: May 07, 2017, 07:50:21 pm »
So the connection establishes? How do you know?

Check the API documentation, it's a second parameter.
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
——————————————————————
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/

 

anything