SFML community forums
Help => Network => Topic started 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
-
Yes, that's possible. But please specify your question. It's like "Is it possible to program Quake 22 with SFML? If so, how?" ;)
-
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. :?
-
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.
-
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:
-
Your PHP page should look something like this:
<?php
$server = $_GET[ "server" ];
$ip = $_GET[ "ip" ];
$port = $_GET[ "port" ];
add_server( $server, $ip, $port );
?>
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).