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

Author Topic: Tcp network test will work on same computer but not on two different computers  (Read 3229 times)

0 Members and 1 Guest are viewing this topic.

deathgrip1235

  • Newbie
  • *
  • Posts: 2
    • View Profile
Hi, I am in serious need of help. I have been looking for an answer for my question since 2 days but haven't found any, (I am new to this forum!) ;D. The problem is I coppiced the code from the tutorial series 'sfml 2.0 made easy' I made slight changes and compiled the code. The code compiled right and worked on the same computer i.e if I run the server and client on the same pc but when I run it on two different pcs (on the same network) it won't work. So please help?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
I strongly advice against the use of code from Coding Made Easy, especially regarding networking. The creator has very limited knowledge in C++, even less in SFML and near zero in networking.
If you want to learn how networking is done right, you should go read the official SFML tutorial, look at the example that ships with SFML, go read all the topics in the official FAQ and once you did all this and still have open questions, you should go and search for binary1248 forum post here in the Network section.
Networking is not an easy topic and it's important to learn things right and not just write something without even having the slightest idea what it does and pray that it won't crash. ;)

Also make sure to follow the general rules for posting, which includes for instance "Give details" or "Identify the problem (a.k.a "complete and minimal code")". :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

deathgrip1235

  • Newbie
  • *
  • Posts: 2
    • View Profile
Ok, so I tried the code from the official tutorials but the problem is still there. Again the problem is that when i use the same computer as the server and the client the program works but when I use another computer as a client and another as a server, it doesn't work. And the two computers are on the same wifi.


I have another question do the computers need to be on a LAN or WLAN for sockets to work?

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
You're still not giving us enough details to work with or clearly stating the problem ("doesn't work" isn't a problem description).

Sockets should work for the internet too.  They'd be quite useless if they could only handle LANs.  But sometimes the way LANs and the internet connect can cause unexpected complications, which is the kind of thing exploiter was referring to.  At some point you'll need to learn the basics of networking so you can troubleshoot this stuff yourself.
« Last Edit: October 26, 2013, 09:58:00 am by Ixrec »

TheRabbit

  • Newbie
  • *
  • Posts: 26
    • View Profile

Ok, so I tried the code from the official tutorials but the problem is still there. Again the problem is that when i use the same computer as the server and the client the program works but when I use another computer as a client and another as a server, it doesn't work. And the two computers are on the same wifi.

Can you post your code using {code} tags? Or a link to the code you used and what changes you made to it.

mvl

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • Email
i am geusing it is something i had  problem with (it stil does not work with my own code ) but at least for the code of others it works
but it is that you need to port forward for the port you are using

 

anything