Raised This Month: $51 Target: $400
 12% 

[EXTENSION] Socket (3.0.1)


Post New Thread Reply   
 
Thread Tools Display Modes
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 11-19-2010 , 14:08   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #311

Logging into Steam requires you to establish an SSL connection, which you cannot do with this.
You could go via your existing PHP script though.
__________________
asherkin is offline
xenland
New Member
Join Date: Nov 2010
Old 11-20-2010 , 00:36   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #312

Probably a stupid question, how would one use this to get the server status using any server side language? (at this point i will learn any language just to get my server status or more precisely the "map name" & "timeleft")

*Note:Serverside meaning php, perl & such

Last edited by xenland; 11-20-2010 at 00:43.
xenland is offline
FunkyLoveCow
Senior Member
Join Date: May 2010
Old 12-02-2010 , 17:34   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #313

How do I get this to work with GET parameters in the URL?

In the example provided with 3.0.1, I am able to download and process forums.alliedmods.net/index.php

However, if I try to download http://forums.alliedmods.net/showthread.php?t=67640 it fails. I've tried on the URL I'd like to process too. If I hit it without parameters it works, but when I add parameters, it fails.

I believe these are the two relevant lines:

Code:
SocketConnect(socket, OnSocketConnected, OnSocketReceive, OnSocketDisconnected, "api.example.com", 80)
Code:
Format(requestStr, sizeof(requestStr), "GET /%s HTTP/1.0\r\nHost: %s\r\nConnection: close\r\n\r\n", "api.php?Type=AllInfo&OFormat=XML", "api.example.com");
PrintToServer(requestStr);
SocketSend(socket, requestStr);
Output to log file:
Code:
GET /api.php?Type=AllInfo&OFormat=XML HTTP/1.0
Host: api.example.com
The file that is download is 0bytes. It should be approximately 13kb. If I hit the URL directly from my browser (or telnet) it works.
FunkyLoveCow is offline
sfPlayer
Senior Member
Join Date: Dec 2007
Location: Germany
Old 12-03-2010 , 13:23   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #314

Use Wireshark to see what's going on.
sfPlayer is offline
OldTimmer
New Member
Join Date: Nov 2009
Old 12-26-2010 , 11:59   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #315

Has anyone had a problem getting Sockets running on GameServers.com.
For some reason I can not get Sockets to run on GameServers.com.
OldTimmer is offline
error 404
New Member
Join Date: Dec 2010
Old 12-27-2010 , 10:24   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #316

Hi guys

I am trying to create a script to ping source servers. my script work well, but only for one IP.
When i change IP, I can see in wireshark command has been send and response has been received on my computer, but script doesn't receive any packets from this ĪP. script receive packet only for first IP, I have defined.

This is a sample of my script

Code:
public OnPluginStart(){
 RegConsoleCmd("sm_ping",Command_Say);
 socketReceive = SocketCreate(SOCKET_UDP, OnSocketError);
 SocketConnect(socketReceive, OnSocketConnected, OnSocketReceive, OnSocketDisconnected,"192.168.0.12",27015);
}
 
public Action:Command_Say(client, args)
{
 new numcmd=GetCmdArgs(); 
 if(numcmd!=2)
 {
  PrintToServer("number argument isn't good!!!");
  return Plugin_Handled;
 }
 
 new String:AddrIP[20];
 new String:Port[20];
 GetCmdArg(1,AddrIP,sizeof(AddrIP));
 GetCmdArg(2,Port,sizeof(Port));
 new String:buffer[]="˙˙˙˙TSource Engine Query";
 SocketSendTo(socketReceive, buffer,sizeof(buffer),AddrIP,StringToInt(Port));
 return Plugin_Handled;
}
I tried to initialise SocketConnect again with new IP, but nothing occurs works only with first IP, I put. I need only to know how to initialise again socket connect for UDP connection with new IP!

I'am working on windows XP x86. I have add my entire script you can use command:
example with my local l4d2 servers IP:192.168.0.12:27015
sm_ping 192.168.0.12 27015
sm_ping2 192.168.0.12 27015
sm_challenge 192.168.0.12 27015 //need to use this before use following commands
sm_details 192.168.0.12 27015
sm_details2 192.168.0.12 27015

if you change IP your computer will receive response but script doesnt receive anything.

Sorry for my bad english
Attached Files
File Type: sp Get Plugin or Get Source (ping.sp - 214 views - 10.0 KB)

Last edited by error 404; 12-27-2010 at 11:09.
error 404 is offline
sfPlayer
Senior Member
Join Date: Dec 2007
Location: Germany
Old 12-27-2010 , 13:47   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #317

A socket will receive packets only from the endpoint used in SocketConnect.

If you actually need to receive data back, you'll have to use SocketConnect + SocketSend + (receive data you need..) + SocketDisconnect for every destination.

Don't use SocketConnect in OnPluginStart, use it in your say callbacks. SocketDisconnect should be in OnSocketReceive. Check SocketIsConnected before trying to connect to catch any missing responses. You should also add timeout timers.

A modified version of your script is attached, I didn't test or even compile it.
Attached Files
File Type: sp Get Plugin or Get Source (ping.sp - 257 views - 12.0 KB)
sfPlayer is offline
error 404
New Member
Join Date: Dec 2010
Old 12-27-2010 , 16:11   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #318

O.M.G., it works very nice, thx a lot sfPlayer.
error 404 is offline
SuperRaWR
SourceMod Donor
Join Date: Jan 2010
Location: Sylvan Lake, Alberta, Ca
Old 01-13-2011 , 21:21   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #319

For some reason, the remoteIP string fromis blank, and I'm unable to send stuff back to the client connected due to this...
Code:
public OnSocketIncoming(Handle:socket, Handle:newSocket, String:remoteIP[], remotePort, any:arg) {

PrintToServer("%s:%d connected", remoteIP, remotePort); //Outputs :53555 connected

}
My port is detected though...

Why would this be?
__________________
[WDZ]SuperRaWR

I use event scripts.
SuperRaWR is offline
Send a message via Skype™ to SuperRaWR
SuperRaWR
SourceMod Donor
Join Date: Jan 2010
Location: Sylvan Lake, Alberta, Ca
Old 01-14-2011 , 22:12   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #320

Also, I've verified that it has something to do with the extension because I've made a Daemon running in PHP that basically handles the expected functionality, and it can output my IP just fine (using the same code for the client connecting), so I'm really not sure why it leaves a blank IP.

Has anyone has this issue in the past?
__________________
[WDZ]SuperRaWR

I use event scripts.
SuperRaWR is offline
Send a message via Skype™ to SuperRaWR
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 19:55.


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