Supression de code inutile

This commit is contained in:
rick 2021-05-20 01:35:58 +02:00
parent e812acaba2
commit 2b9d0d78db
Signed by: Rick
GPG key ID: 2B593F087240EE99

31
test.sp
View file

@ -1,7 +1,5 @@
#include <sourcemod>
#include <clients>
#include <cstrike>
#include <sdktools>
#include "socket.inc"
#define MY_SOCKET_IP "localhost"
@ -149,7 +147,6 @@ public Action TestSocket(int args)
PrintToServer("envoie socket");
Handle socket = SocketCreate(SOCKET_TCP, OnSocketError);
SocketConnect(socket, SocketUpdateScore, OnSocketReceive, OnSocketDisconnected, MY_SOCKET_IP, MY_SOCKET_PORT);
//CloseHandle(socket);
return Plugin_Handled;
}
@ -157,7 +154,6 @@ public Action TestSocketA(int args)
{
Handle socket = SocketCreate(SOCKET_TCP, OnSocketError);
SocketConnect(socket, SocketEnvoieVictoire, OnSocketReceive, OnSocketDisconnected, MY_SOCKET_IP, MY_SOCKET_PORT);
//CloseHandle(socket);
return Plugin_Handled;
}
@ -196,39 +192,14 @@ public void SocketEnvoieVictoire(Handle socket, any arg)
CloseHandle(socket);
}
public void OnSocketConnected(Handle socket, 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 void OnSocketReceive(Handle socket, const char[] datas, const int data, any arg) {}
public OnSocketDisconnected(Handle socket, any arg)
{
PrintToServer("Salut mon pote");
CloseHandle(socket);
}
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);
CloseHandle(hFile);
CloseHandle(socket);
}