Raised This Month: $ Target: $400
 0% 

httpget in plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Elbandi
Member
Join Date: Jun 2005
Location: Budapest, Hungary
Old 10-17-2005 , 11:02   httpget in plugin
Reply With Quote #1

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:
Code:
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
Elbandi is offline
Send a message via ICQ to Elbandi Send a message via MSN to Elbandi
XAD
Senior Member
Join Date: Mar 2004
Location: Sweden
Old 10-17-2005 , 12:08   Re: httpget in plugin
Reply With Quote #2

Quote:
Originally Posted by Elbandi
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
XAD is offline
cybermind
Senior Member
Join Date: Oct 2004
Old 11-02-2005 , 12:45  
Reply With Quote #3

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/...s/connect.html
Win32: http://msdn.microsoft.com/library/de.../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.
cybermind is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:40.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode