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

Author Topic: Having Trouble with SocketTCP::Connect  (Read 2825 times)

0 Members and 1 Guest are viewing this topic.

SocketProbs

  • Newbie
  • *
  • Posts: 2
    • View Profile
Having Trouble with SocketTCP::Connect
« on: July 02, 2010, 10:11:54 pm »
I used the example program of the chat client/server with TCP Ports. Just like this:
Code: [Select]

//Server:
sf::SocketTCP Server;
Server.Listen(Port); //returns true

//Client
sf::IPAddress ServerAddress("An IP");
sf::SocketTCP Client;
Client.Connect(Port, ServerAddress); //Error

If I connect to my own LAN-IP Adress, the program works. If I connect to 127.0.0.1, the program works.
But if i try to connect to someone else's internet IP or even my own Internet IP, I cannot get a connection.
I think my firewall is blocking this connection attempt. But I also cannot connect with Ports that work in other programs for me.
Do I have to call another function which "unblocks" the port or something?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Having Trouble with SocketTCP::Connect
« Reply #1 on: July 02, 2010, 11:08:42 pm »
No, you must open the port manually in your router config.
Laurent Gomila - SFML developer

SocketProbs

  • Newbie
  • *
  • Posts: 2
    • View Profile
Having Trouble with SocketTCP::Connect
« Reply #2 on: July 02, 2010, 11:22:16 pm »
Thanks for your fast reply!
Can i find out which ports are opened? Maybe with a SFML function?
And how do other programs connect me to servers (like my browser or online games)? Do they use the same TCP/Port system?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Having Trouble with SocketTCP::Connect
« Reply #3 on: July 02, 2010, 11:27:25 pm »
Browsers use the standard HTTP ports (80, 440) which are always opened, and online games probably use uPnP. I'm not sure.

You can't use an open port, because it is most likely open for another protocol or application. Your application has to use its own port.
Laurent Gomila - SFML developer

Mindiell

  • Hero Member
  • *****
  • Posts: 1261
    • ICQ Messenger - 41484135
    • View Profile
Having Trouble with SocketTCP::Connect
« Reply #4 on: July 06, 2010, 11:44:13 am »
on-line games are client, they, usually, don't need to open a specific port. Like web client, web radios, etc... ;)

You have the server, some people want to connect to your computer, then you will have to open at least one specific port.
Mindiell
----

 

anything