PDA

View Full Version : httpget in plugin


Elbandi
10-17-2005, 11:02
hi

I want to get some data from a web page (php). i write my own function: getdatafromnet, and use the standard tcp functions: connect, send, recv, close.
But if this func is called, and getting the data, the server is stalled for a 1-2 sec. This is not good :(

the www.steambans.com plugin have a httpget feautre:

sb_customurl :
The URL for Silver or larger licenses, more info gets shown to them.
Ex: sb_customurl "http://www.host.com/check.php?id=%s&name=%s&sip=%s&sport=%s&cip=%s
This will send: The SteamID, Nick, ServerIP, Server port, Client IP to the webserver.
Return data should be specified the same way sb_amxbansurl returns data.


so somehow can make that.

Elbandi
sorry my poor english :(

XAD
10-17-2005, 12:08
I want to get some data from a web page (php). i write my own function: getdatafromnet, and use the standard tcp functions: connect, send, recv, close.
Don't unless you add multi-threading as the CSS-server will stop while waiting for the result...

Let the clients do the http requests...

/X

cybermind
11-02-2005, 12:45
Use non-blocking sockets and use select/poll to check if the connect succeeded and if there is data waiting to be recv'd. This should eliminate the lag.

*nix: http://www.opengroup.org/onlinepubs/009695399/functions/connect.html
Win32: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/connect_2.asp

Also, try to use the IP of the server in the URL unless you want to write your own DNS resolution functions, since that can cause a lot of lag too.