SFML community forums

Help => Network => Topic started by: mikedee on December 19, 2009, 07:40:37 am

Title: Creating a server list for online games
Post by: mikedee on December 19, 2009, 07:40:37 am
Is it possible to create a server list for online games using SFML's network package ?
If so how ?


Great work with SFML btw !  :D
Title: Creating a server list for online games
Post by: Tank on December 19, 2009, 01:39:27 pm
Yes, that's possible. But please specify your question. It's like "Is it possible to program Quake 22 with SFML? If so, how?" ;)
Title: Creating a server list for online games
Post by: mikedee on December 19, 2009, 04:03:04 pm
I'm sorry, basically what I want is a way to interact with a mySQL database.
This can be done via php, but what I want to know exactly is how to interact with a php page.

For example: that php page has a function called add_server(servername,ip,port) which like the name implies, adds a new server to the server list. I can specify the server name, ip and port variables, but I don't know how I could trigger the function. I'm pretty sure I have to use TCP for the job, but I don't know how exactly.  :?
Title: Creating a server list for online games
Post by: lotios611 on December 19, 2009, 11:12:17 pm
So what you want is a way to interact with a MySQL database from C++? I don't think you can do that with SFML. I think Qt has functions to do what you want.
Title: Creating a server list for online games
Post by: mikedee on December 20, 2009, 02:56:57 am
I don't have to deal with mysql directly, the php page will take care of that. What I need is a way to trigger the functions of the php page so that it can work with MySQL table.  :wink:
Title: Creating a server list for online games
Post by: JollyRoger on December 20, 2009, 03:09:17 am
Your PHP page should look something like this:
Code: [Select]

<?php
 $server 
$_GET"server" &#93;;
 
$ip $_GET"ip" &#93;;
 
$port $_GET"port" &#93;;

 
add_server&#40; $server, $ip, $port &#41;;
?>



And then call "yourpage.php?server=servervar&ip=ipvar&port=portvar" using a sf::Http::Request (http://www.sfml-dev.org/tutorials/1.5/network-http.php).