Raised This Month: $ Target: $400
 0% 

Need help: Socket On CS:GO?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wwzw
Member
Join Date: Feb 2009
Old 02-21-2013 , 22:52   Need help: Socket On CS:GO?
Reply With Quote #1

I need a socket extensions, I found Socket3.0.1 at http://forums.alliedmods.net/showthread.php?t=67640 . But that can not work on CS:GO.
Can someone help me? Thanks!
wwzw is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 02-22-2013 , 12:02   Re: Need help: Socket On CS:GO?
Reply With Quote #2

As far as I know, it should work on cs:go at 100%, simply because the extension do not interract with any game part, a bit like SQL, if I am not wrong. Why it wouldnt work? Any error message?
Mathias. is offline
wwzw
Member
Join Date: Feb 2009
Old 02-22-2013 , 19:48   Re: Need help: Socket On CS:GO?
Reply With Quote #3

I use listenexample.sp example:

PHP Code:
// listening socket example for the socket extension
#include <sourcemod>
#include <socket>
public Plugin:myinfo = {
 
name "listen socket example",
 
author "Player",
 
description "This example provides a simple echo server",
 
version "1.0.1",
 
url "http://www.player.to/"
};
 
public 
OnPluginStart() {
 
SocketSetOption(INVALID_HANDLEDebugMode1);
 new 
Handle:socket SocketCreate(SOCKET_TCPOnSocketError);
 
SocketBind(socket"0.0.0.0"50000);
 
SocketListen(socketOnSocketIncoming);
}
public 
OnSocketIncoming(Handle:socketHandle:newSocketString:remoteIP[], remotePortany:arg) {
 
PrintToServer("%s:%d connected"remoteIPremotePort);
 
SocketSetReceiveCallback(newSocketOnChildSocketReceive);
 
SocketSetDisconnectCallback(newSocketOnChildSocketDisconnected);
 
SocketSetErrorCallback(newSocketOnChildSocketError);
 
SocketSend(newSocket"send quit to quit\n");
}
public 
OnSocketError(Handle:socket, const errorType, const errorNumany:ary) {
 
LogError("socket error %d (errno %d)"errorTypeerrorNum);
 
CloseHandle(socket);
}
public 
OnChildSocketReceive(Handle:socketString:receiveData[], const dataSizeany:hFile) {
 
SocketSend(socketreceiveData);
 if (
strncmp(receiveData"quit"4) == 0CloseHandle(socket);
}
public 
OnChildSocketDisconnected(Handle:socketany:hFile) {
 
CloseHandle(socket);
}
public 
OnChildSocketError(Handle:socket, const errorType, const errorNumany:ary) {
 
LogError("child socket error %d (errno %d)"errorTypeerrorNum);
 
CloseHandle(socket);


Then I use PHP's fsockopen function to send a string. Like this:

PHP Code:
function fsgetdata$port$send)
{
 
$fp fsockopen("tcp://127.0.0.1"$port$errno$errstr1);
 if (!
$fp) {
  return -
1;
 }
 
stream_set_timeout($fp2);
 
fwrite($fp$send);
 
$status stream_get_meta_data($fp);
 if( 
$status['timed_out'] ) {
  
fclose$fp );
  return -
2;
 }
 
$data .= fread($fp4096);
 
//while (!feof($fp))             //This will generate PHP 30 second timeout
 // $data .= fgets($fp, 512);
 
$data trim($datachr(255));
 
$status stream_get_meta_data($fp);
 
fclose($fp);
 return !
$status['time_out'] ? $data : -2;
}
$ch fsgetdata50000"Some msg for test");
 
echo 
"[".$ch."]";
//If not start the server, output "-1"
//Else Was not able to show anything 
Does not display any messages to the console. There is no record of any log.

I used: CS:GO latest version of yesterday. MM :1.9.2 . SM 1.5-hg3786

Last edited by wwzw; 02-22-2013 at 19:53.
wwzw is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 02-22-2013 , 20:17   Re: Need help: Socket On CS:GO?
Reply With Quote #4

I'm not a php master, but I can clearly tell you that is not the extension the problem.
Mathias. is offline
wwzw
Member
Join Date: Feb 2009
Old 02-22-2013 , 20:27   Re: Need help: Socket On CS:GO?
Reply With Quote #5

This PHP function should be no errors, I use this function to send a message to scoket_hz.amxx.dll (AMX MOD X), and the right to obtain reply data.

May I ask who has been successfully using Scoket 3.0.1 CS: GO server?

PHP Code:
version
Protocol version 12223
Exe version 1.22.2.3 
(csgo)
Exe build13:44:21 Feb 20 2013 (5218) (730)
meta version
Metamod
:Source version 1.9.2
Build ID
811:a85baef2eadb
Loaded 
As: GameDLL (gameinfo.txt)
Compiled onFeb  6 2013
Plugin 
interface version15:14
SourceHook version
5:5
http
://www.metamodsource.net/
meta list
Listing 3 plugins:
  [
01SourceMod (1.5.0-dev+3786by AlliedModders LLC
  
[02CS Tools (1.5.0-dev+3786by AlliedModders LLC
  
[03SDK Tools (1.5.0-dev+3786by AlliedModders LLC
sm exts 
list
[
SMDisplaying 11 extensions:
[
01Automatic Updater (1.5.0-dev+3786): Updates SourceMod gamedata files
[02Webternet (1.5.0-dev+3786): Extension for interacting with URLs
[03CS Tools (1.5.0-dev+3786): CS extended functionality
[04BinTools (1.5.0-dev+3786): Low-level C/C++ Calling API
[05SDK Tools (1.5.0-dev+3786): Source SDK Tools
[06Top Menus (1.5.0-dev+3786): Creates sorted nested menus
[07Client Preferences (1.5.0-dev+3786): Saves client preference settings
[08SQLite (1.5.0-dev+3786): SQLite Driver
[09Regex (1.5.0-dev+3786): Provides regex natives for plugins
[10Socket (3.0.1): Socket extension for SourceMod
[11MySQL-DBI (1.5.0-dev+3786): MySQL driver implementation for DBI 

Last edited by wwzw; 02-22-2013 at 20:47.
wwzw is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 02-22-2013 , 21:02   Re: Need help: Socket On CS:GO?
Reply With Quote #6

Try the same code with an other source server, I bet you will have the same result. How to explain you this... Basicly this extension should not change any game data anything related to the game, it the same as SQL, Regex and everything that don't change anything related to the game but are offer to use with it.
Mathias. is offline
wwzw
Member
Join Date: Feb 2009
Old 02-22-2013 , 21:47   Re: Need help: Socket On CS:GO?
Reply With Quote #7

I am in the CS:S server test, it can work!
The console display:
PHP Code:
:58776 connected 
PHP page also display: ($data = fread ($fp, 4096); receive data)
PHP Code:
send quit to quit 
I edit some code of listenexample.sp:
PHP Code:
public OnChildSocketReceive(Handle:socketString:receiveData[], const dataSizeany:hFile) {
 
PrintToServer("Receive: %s"receiveData);
 
SocketSend(socketreceiveData);
 
CloseHandle(socket);

Then I use the following code to receive all the data:
PHP Code:
//$data .= fread($fp, 4096);
while (!feof ($fp))
$data. = fgets ($fp512); 
Console display:
PHP Code:
:60140 connected
Receive
Some msg for test 
PHP web page display:
PHP Code:
send quit to quit Some msg for test 
This obviously: socket3.0.1 on the CS:S is the work is successful, but in the CS:GO is not working properly.

Last edited by wwzw; 02-22-2013 at 22:11.
wwzw is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 02-22-2013 , 22:06   Re: Need help: Socket On CS:GO?
Reply With Quote #8

Hum weird, like I said I was not sure, maybe your right. Good to know this, would be nice if someone more experienced could explain us what going on or even solve the problem.
Mathias. is offline
wwzw
Member
Join Date: Feb 2009
Old 03-08-2013 , 20:33   Re: Need help: Socket On CS:GO?
Reply With Quote #9

Thanks for Crytiqal !

I tested: When I login to the server, Socket work properly!
But ... how to make the Socket work, when no player on the server?
wwzw is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 03-08-2013 , 20:39   Re: Re: Need help: Socket On CS:GO?
Reply With Quote #10

Quote:
Originally Posted by wwzw View Post
Thanks for Crytiqal !

I tested: When I login to the server, Socket work properly!
But ... how to make the Socket work, when no player on the server?
Try turning off hibernation
Doc-Holiday 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:58.


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