GNET "failed to add server" everytime

Blitz3D Forums/Blitz3D Programming/GNET "failed to add server" everytime

I'm running the GNET simple example:

;Simple gnet demo
;
;Check out www.blitzbasic.com/gnet/gnet_servers.php while running!
;

Include "gnet_inc.bb"

my_game$="My_Game"

;ping!
Print "Ping:"+GNET_Ping()
Print ""

;list active servers
;
ListServers()

;add a server!
;
Print "Adding server..."
Print ""

If Not GNET_AddServer( my_game$ )
	RuntimeError "Failed to add server"
EndIf

;list active servers
;
ListServers()

;refresh server!
;
Input "Hit return to refresh server..."
Print ""

If Not GNET_RefreshServer( my_game$,"New Server Name!" )
	RuntimeError "Failed to refresh server"
EndIf

;list active servers
;
ListServers()

;remove ourselves!
;
Input "Hit return to remove server and exit..."
Print ""

If Not GNET_RemoveServer( my_game$ )
	RuntimeError "Failed to remove server"
EndIf

End

Function ListServers()
	If Not GNET_ListServers()
		RuntimeError "Failed to list servers"
	EndIf
	
	Print LSet$("Game",16)+LSet$("Server",32)+LSet$("IP",16)
	Print String$("-",64)
	For t.GNET_Server=Each GNET_Server
		Print LSet$(t\game$,16)+LSet$(t\server$,32)+LSet$(t\ip$,16)
	Next
	Print ""
End Function


and its giving me Failed To Add Server everytime. I'm a client with a stable internet connection so I dont see whats wrong. It worked before.

Try a different value for my_game$ = "..."

also check your firewall / router in case it's gettting blocked

nope. I checked my firewall exceptions and it was there. I tried to change the name but it still giving me Failed to add server

The gnet page has been showing the same three games for the last month or more. I'd guess the service has gone the way of the dodo. If you don't find that it's your code that's the problem, then I'd suggest you email Blitz Research and let them know there might be a problem with their gnet service.

yes, i tried gnet in my own game and i'm still getting failed to add server. I'll email the Blitz Research.

This code is working perfectly for me,

try to see if there's any difference with yours:

this is the "gnet_inc.bb":

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

Type GNET_Server
	Field game$,server$,ip$
End Type

Function GNET_Esc$( t$ )
	t$=Replace$( t$,"&","" )
	t$=Replace$( t$,"%","" )
	t$=Replace$( t$,"'","" )
	t$=Replace$( t$,Chr$(34),"" )
	t$=Replace$( t$," ","_" )
	Return t$
End Function

Function GNET_Open( opt$ )
	t=OpenTCPStream( GNET_HOST$,GNET_PORT )
	If Not t Return 0
	
	WriteLine t,"GET "+GNET_GET$+"?opt="+opt$+" HTTP/1.0"
	WriteLine t,"HOST: "+GNET_HOST$
	WriteLine t,""
	
	While ReadLine$(t)<>""
	Wend
	
	Return t
End Function

Function GNET_Exec( opt$,game$,server$ )
	opt$=opt$+"&game="+GNET_Esc$(game$)
	If server$<>"" opt$=opt$+"&server="+GNET_Esc$(server$)
	t=GNET_Open( opt$ )
	If Not t Return 0
	
	ok=False
	If( ReadLine$(t)="OK" ) ok=True
	
	CloseTCPStream t
	Return ok
End Function

Function GNET_Ping$()
	t=GNET_Open( "ping" )
	If Not t Return 0
	
	ip$=ReadLine$(t)
	
	CloseTCPStream t
	Return ip$
End Function

Function GNET_AddServer( game$,server$="" )
	Return GNET_Exec( "add",game$,server$ )
End Function

Function GNET_RefreshServer( game$,server$="" )
	Return GNET_Exec( "ref",game$,server$ )
End Function

Function GNET_RemoveServer( game$ )
	Return GNET_Exec( "rem",game$,"" )
End Function

Function GNET_ListServers( game$="" )
	Delete Each GNET_Server
	t=GNET_Open( "list" )
	If Not t Return 0
	
	Repeat
		t_game$=ReadLine$(t)
		If t_game$="" Exit
		t_server$=ReadLine$(t)
		t_ip$=ReadLine(t)
		If game$="" Or game$=t_game$
			p.GNET_Server=New GNET_Server
			p\game$=t_game$
			p\server$=t_server$
			p\ip$=t_ip$
		EndIf
	Forever
	
	CloseTCPStream t
	Return 1
	
End Function



this is the testing code:
;Simple gnet demo
;
;Check out www.blitzbasic.com/gnet/gnet_servers.php while running!
;

Include "gnet_inc.bb"

my_game$="My_Game_TestingGNet"

;ping!
Print "Ping:"+GNET_Ping()
Print ""

;list active servers
;
ListServers()

;add a server!
;
Print "Adding server..."
Print ""

If Not GNET_AddServer( my_game$ )
	RuntimeError "Failed to add server"
EndIf

;list active servers
;
ListServers()

;refresh server!
;
Input "Hit return to refresh server..."
Print ""

If Not GNET_RefreshServer( my_game$,"New Server Name!" )
	RuntimeError "Failed to refresh server"
EndIf

;list active servers
;
ListServers()

;remove ourselves!
;
Input "Hit return to remove server and exit..."
Print ""

If Not GNET_RemoveServer( my_game$ )
	RuntimeError "Failed to remove server"
EndIf

End

Function ListServers()
	If Not GNET_ListServers()
		RuntimeError "Failed to list servers"
	EndIf
	
	Print LSet$("Game",16)+LSet$("Server",32)+LSet$("IP",16)
	Print String$("-",64)
	For t.GNET_Server=Each GNET_Server
		Print LSet$(t\game$,16)+LSet$(t\server$,32)+LSet$(t\ip$,16)
	Next
	Print ""
End Function



Paolo.

[EDIT] Anyway, for GNet I suggest using ETNA
http://repeatuntil.online.fr/Etna/

oh geez, im an idiot. The path for the PHP script is wrong! Thanks, guys. Sorry for wasting your time.