13.12.2017, 17:08
Hi,
i have an issue with this plugin.
The server seems to close connections to the connected clients randomly (gmx/restart of the server is not triggered)
This is my pawn code where i bind and listen for connections/data:
I made an app (=client) that connects to the server chat.
Works just fine.
BUT, from time to time (totally random it seems), i get this error message on the client side:
Seems like the server randomly closes the conenction to my clients?
Can you give me a hint where to look for the bug?
Or is it another bug by the plugin, an issue you already know about?
Someone experienced this before?
Im running this on linux.
Thank you!
i have an issue with this plugin.
The server seems to close connections to the connected clients randomly (gmx/restart of the server is not triggered)
This is my pawn code where i bind and listen for connections/data:
pawn Код:
#include <a_samp>
#include <socket>
new Socket:CLIENT_SOCKET;
#define SOCKET_PORT 7785
#define SOCKET_MAX_CONNECTION 25
new connected_remote_clients;
public OnGameModeInit()
{
new ip[16];
GetServerVarAsString("bind", ip, sizeof (ip));
connected_remote_clients=0;
CLIENT_SOCKET = socket_create(TCP);
if(is_socket_valid(CLIENT_SOCKET))
{
socket_set_max_connections(CLIENT_SOCKET, SOCKET_MAX_CONNECTION);
socket_bind(CLIENT_SOCKET, ip);
socket_listen(CLIENT_SOCKET, SOCKET_PORT);
}
return 1;
}
public OnGameModeExit()
{
if(is_socket_valid(CLIENT_SOCKET))socket_destroy(CLIENT_SOCKET);
return 1;
}
public onSocketRemoteConnect(Socket:id, remote_client[], remote_clientid)
{
connected_remote_clients++;
return 1;
}
public onSocketReceiveData(Socket:id, remote_clientid, data[], data_len)
{
print(data);
SendSocketMessageToAllClients(data);
return 1;
}
public OnPlayerText(playerid, text[])
{
SendSocketMessageToAllClients(text);
return 1;
}
forward SendSocketMessageToAllClients(socket_message[]);
public SendSocketMessageToAllClients(socket_message[])
{
for(new client_i=0; client_i<connected_remote_clients; client_i++)
{
if(is_socket_valid(CLIENT_SOCKET))socket_sendto_remote_client(CLIENT_SOCKET, client_i, socket_message);
}
return 1;
}
Works just fine.
BUT, from time to time (totally random it seems), i get this error message on the client side:
PHP код:
[Errno 10054] An existing connection was forcibly closed by the remote host.
Can you give me a hint where to look for the bug?
Or is it another bug by the plugin, an issue you already know about?
Someone experienced this before?
Im running this on linux.
Thank you!