Gnet / gnet_servers.php

Miscellaneous Forums/General Discussion/Gnet / gnet_servers.php

Anyone know how to set this up on your own server? I asked in the blitz3d programming area but that might not have been the best place. I want to have a server listing on my own site instead of using the Blitz site but when using Gnet.php all I get is a white page with "error" so im assuming I need gnet_servers.php ? thanks

...

no thats Gnet.php I have that and thats what gives me the error, I assumed there was some kind of other php scripts or something.

Do you have the database set up right? If the fields aren't of the proper type then it doesn't work.

Yes I believe so I used this in mySQL

CREATE TABLE gnet_servers (
game varchar(32) NOT NULL default '',
server varchar(32) NOT NULL default '',
extip varchar(32) NOT NULL default '',
intip varchar(32) NOT NULL default '',
port smallint(5) unsigned NOT NULL default '0',
t_time timestamp(14) NOT NULL
) TYPE=MyISAM;

OK, the table in my database is called "gnet_servers"

The fields are:

"game" - varchar(size 25)
"server" - varchar(size 25)
"ip" - varchar(size 15)
"t_time" - datetime

give it a shot when i get home thanks.

can you paste your entire create table ? I tried that and it didnt work :/ get the same "ERROR"

I'm using phpMyAdmin to create the tables.

Hi Ckob,

in the gnet.php, it is assumed that your database is already opened and accessible. If you put it on your server, you should connect to your database, and so add a mysql_connect() and mysql_select_db().

Also, don't miss the new library coming soon which has a version of gnet using thread (no freeze of your program). Check it out here: http://www.blitzmax.com/Community/posts.php?topic=55724
It will be released soon...

Disclaimer: I don't know what I'm talking about.

I got GNet working on my own server by doing something like this (assuming phpMyAdmin is installed already by your web host; if not, I've no idea how you install it)...

· Download and unarchive GNet;
· Add this to gnet.php, after the first line (ie. before "//Assumes DB already open"):

$_server = "localhost";
$_dbname = "your_database_name";
$_usname = "your_user_name";
$_paswrd = "password";
$_conect = mysql_connect($_server, $_usname, $_paswrd) or die( mysql_error() );
mysql_select_db($_dbname, $_conect);

In my case, user_name and database_name are the same--the database was there by default; you might have to add it. The username and password were the same as the FTP login details in my case.

· Copy the modified gnet.php into a folder on your FTP site;
· Assuming you have phpMyAdmin on your server, browse to http://www.yourdomain.com:85 and log in as prompted;
· Click on username/database name in left-hand frame;
· Click on SQL in resulting right-hand frame;
· In box marked "Run SQL query/queries on database", copy and paste this code (posted by Frank Taylor)...

DROP TABLE IF EXISTS `gnet_servers`;
CREATE TABLE `gnet_servers` (
  `id` tinyint(3) unsigned NOT NULL default '0',
  `t_time` timestamp(14) NOT NULL,
  `game` text,
  `server` text,
  `ip` text,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `id` (`id`)
) TYPE=MyISAM;


Modify the top of gnet_inc.bb to:

Const GNET_HOST$="www.yourdomain.com"
Const GNET_PORT=80
Const GNET_GET$="/your_sub_folder/gnet.php"


... and run gnet_test.bb

If it doesn't work, don't ask me, as I only got it working through trial and error--I haven't got a clue about PHP/mySQL. You may have to engage in a little trial-and-error. (My version of phpMyAdmin is 2.6.4-pl4 BTW.)

hmm still not working and I know im doing it all correctly perhaps my host is blocking this ill contact them.

this is the gnet site.

http://www.banishedstudios.com/Gnet/gnet.php

thats what happens and yes ive done everything here which is all that i tried previously. :/ so like I said above maybe its my host?

I know this is 3 months old, but it's the thread that comes up in a search. I got this working last night and it looks to me that the banished studios page is probably correct. The error is the textual output from that php page but the gnet functionality works fine from in game.

You can change the echo statement to something else, or put a page design in there and list the games like Blitz has. Personally i'm trying to figure out how to extract total servers & players online for use on other pages.