socket not listening
#1

I don't know what is the problem but the socket is just not listening, i used udp and it worked, but then i switched to tcp and its not working

pawn Код:
Das funktioniert nicht. Ich war UDP und wechselte zu TCP und jetzt ist es nicht funktioniert.

​
C-Quellcode
Quellcode bearbeiten
#include <a_samp>
#include <socket>
&#8203;
new Socket:g_Socket;
&#8203;
main () {}
&#8203;
public OnGameModeInit()
{
    g_Socket = socket_create(TCP);
    if(is_socket_valid(g_Socket)) {
        socket_set_max_connections(g_Socket, 10);
        socket_bind(g_Socket, "192.168.1.103");
        socket_listen(g_Socket, 7775);
    }
    return 1;
}
&#8203;
public OnGameModeExit()
{
    if(is_socket_valid(g_Socket))
        socket_destroy(g_Socket);
}
&#8203;
public onSocketRemoteConnect(Socket:id, remote_client[], remote_clientid)
{
    printf("Incoming connection from [%d:%s]", remote_clientid, remote_client);
    socket_send(id, "Welcome :)");
    return 1;
}
&#8203;
public onSocketRemoteDisconnect(Socket:id, remote_clientid)
{
    printf("Remote client [%d] has disconnected.", remote_clientid);
    return 1;
}
&#8203;
public onSocketReceiveData(Socket:id, remote_clientid, data[], data_len)
{
    printf("Remote client [%d] has sent: %s", remote_clientid, data);
    return 1;
}
&#8203;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)