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

Read argumentes (socket ext)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 05-25-2010 , 06:26   Read argumentes (socket ext)
Reply With Quote #1

PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <socket>
#define PLUGIN_VERSION "0100"

public Plugin:myinfo = {
    
name             "N/A",
    
author             "Leonardo",
    
description     "N/A",
    
version         PLUGIN_VERSION,
    
url             "www.sourcemod.net"
};
 
public 
OnPluginStart() {
    new 
Handle:socket SocketCreate(SOCKET_TCPOnSocketError);
    
SocketSetArg(socket"sourceMod");
    
SocketConnect(socketOnSocketConnectedOnSocketReceiveOnSocketDisconnected"google.com"80);
}

public 
OnSocketConnected(Handle:socketany:arg) {
    
decl String:requestStr[128];
    
Format(requestStrsizeof(requestStr), "GET /%s HTTP/1.0\r\nHost: %s\r\nConnection: close\r\n\r\n""search?q=%s""leosrv.gotdns.org"_???_);
    
SocketSend(socketrequestStr);
}

public 
OnSocketReceive(Handle:socketString:receiveData[], const dataSizeany:arg) { LogMessage("socket done"); }

public 
OnSocketDisconnected(Handle:socketany:arg) { CloseHandle(socket); }

public 
OnSocketError(Handle:socket, const errorType, const errorNumany:arg) { LogError("socket error %d (errno %d)"errorTypeerrorNum); CloseHandle(socket); } 
how to get argumentes in OnSocketConnected?
__________________

Last edited by Leonardo; 05-25-2010 at 07:18.
Leonardo is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 05-25-2010 , 12:43   Re: Read argumentes (socket ext)
Reply With Quote #2

Quote:
Originally Posted by Leonardo View Post
how to get argumentes in OnSocketConnected?
public OnSocketConnected(Handle:socket, any:arg) {

There you go.
__________________
plop
p3tsin is offline
sfPlayer
Senior Member
Join Date: Dec 2007
Location: Germany
Old 05-25-2010 , 12:59   Re: Read argumentes (socket ext)
Reply With Quote #3

I don't think you can pass a string there. Try using a datapack to wrap it.
sfPlayer is offline
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 05-25-2010 , 14:13   Re: Read argumentes (socket ext)
Reply With Quote #4

Quote:
Originally Posted by p3tsin View Post
public OnSocketConnected(Handle:socket, any:arg) {

There you go.
what is a type of arg?

sfPlayer, okay so...
__________________

Last edited by Leonardo; 02-19-2011 at 19:23. Reason: removed russian words
Leonardo is offline
sfPlayer
Senior Member
Join Date: Dec 2007
Location: Germany
Old 05-25-2010 , 17:34   Re: Read argumentes (socket ext)
Reply With Quote #5

you can use an integer, float or handle
sfPlayer 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 19:43.


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