Supression de code inutile
This commit is contained in:
parent
e812acaba2
commit
2b9d0d78db
1 changed files with 1 additions and 30 deletions
31
test.sp
31
test.sp
|
@ -1,7 +1,5 @@
|
||||||
#include <sourcemod>
|
#include <sourcemod>
|
||||||
#include <clients>
|
|
||||||
#include <cstrike>
|
#include <cstrike>
|
||||||
#include <sdktools>
|
|
||||||
#include "socket.inc"
|
#include "socket.inc"
|
||||||
|
|
||||||
#define MY_SOCKET_IP "localhost"
|
#define MY_SOCKET_IP "localhost"
|
||||||
|
@ -149,7 +147,6 @@ public Action TestSocket(int args)
|
||||||
PrintToServer("envoie socket");
|
PrintToServer("envoie socket");
|
||||||
Handle socket = SocketCreate(SOCKET_TCP, OnSocketError);
|
Handle socket = SocketCreate(SOCKET_TCP, OnSocketError);
|
||||||
SocketConnect(socket, SocketUpdateScore, OnSocketReceive, OnSocketDisconnected, MY_SOCKET_IP, MY_SOCKET_PORT);
|
SocketConnect(socket, SocketUpdateScore, OnSocketReceive, OnSocketDisconnected, MY_SOCKET_IP, MY_SOCKET_PORT);
|
||||||
//CloseHandle(socket);
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +154,6 @@ public Action TestSocketA(int args)
|
||||||
{
|
{
|
||||||
Handle socket = SocketCreate(SOCKET_TCP, OnSocketError);
|
Handle socket = SocketCreate(SOCKET_TCP, OnSocketError);
|
||||||
SocketConnect(socket, SocketEnvoieVictoire, OnSocketReceive, OnSocketDisconnected, MY_SOCKET_IP, MY_SOCKET_PORT);
|
SocketConnect(socket, SocketEnvoieVictoire, OnSocketReceive, OnSocketDisconnected, MY_SOCKET_IP, MY_SOCKET_PORT);
|
||||||
//CloseHandle(socket);
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,39 +192,14 @@ public void SocketEnvoieVictoire(Handle socket, any arg)
|
||||||
CloseHandle(socket);
|
CloseHandle(socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnSocketConnected(Handle socket, any arg)
|
public void OnSocketReceive(Handle socket, const char[] datas, const int data, any arg) {}
|
||||||
{
|
|
||||||
char requestStr[150];
|
|
||||||
Format(requestStr, sizeof(requestStr), "%s", "Source Engine Query");
|
|
||||||
|
|
||||||
/*
|
|
||||||
FormatEx(
|
|
||||||
requestStr,
|
|
||||||
sizeof(requestStr),
|
|
||||||
"GET /%s HTTP/1.0\r\nHost: %s\r\nConnection: close\r\n\r\n",
|
|
||||||
"prout",
|
|
||||||
"mario"
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
|
|
||||||
SocketSend(socket, requestStr, 150);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnSocketReceive(Handle socket, const char[] datas, const int data, any arg)
|
|
||||||
{
|
|
||||||
PrintToServer("=== INFO ===\n%s", datas);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OnSocketDisconnected(Handle socket, any arg)
|
public OnSocketDisconnected(Handle socket, any arg)
|
||||||
{
|
{
|
||||||
PrintToServer("Salut mon pote");
|
|
||||||
CloseHandle(socket);
|
CloseHandle(socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnSocketError(Socket socket, const int errorType, const int errorNum, any hFile) {
|
public void OnSocketError(Socket socket, const int errorType, const int errorNum, any hFile) {
|
||||||
// a socket error occured
|
|
||||||
|
|
||||||
PrintToServer("socket error %d (errno %d)", errorType, errorNum);
|
PrintToServer("socket error %d (errno %d)", errorType, errorNum);
|
||||||
CloseHandle(hFile);
|
|
||||||
CloseHandle(socket);
|
CloseHandle(socket);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue