SA-MP Forums Archive
samp listening to udp - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: samp listening to udp (/showthread.php?tid=608101)



samp listening to udp - ShoortyFl - 27.05.2016

I have a problem with listening to udp connection, in visual basic i made a udp connection but when i connect to server over my application i dont get any debug, this is visual basic:

pawn Код:
Dim bytCommand As Byte() = New Byte() {}

                    Dim publisher As New Sockets.UdpClient()

                    publisher.Connect("192.168.1.103", 7775)
                    Dim sendbytes() As Byte = ASCII.GetBytes(TextBox1.Text)
                    publisher.Send(sendbytes, sendbytes.Length)

This is pawn:


pawn Код:
public OnGameModeInit()
{
    if(udpConnect("192.168.1.103", 7775))
    {
        printf("The server has been connected to ucp.");
    }

    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public onSocketReceiveData(Socket:id, remote_clientid, data[], data_len)
{
    print("Nova launcher konekcija"); // ovo ne ispisuje kada stisnem connect
    return 1;
}

stock udpConnect(ip[], port)
{
    Launcher = socket_create(UDP);
    return socket_connect(Launcher, ip, port);
}



Re: samp listening to udp - Sew_Sumi - 27.05.2016

This isn't so much Scripting Help, but you should check with people whether you're allowed to actually do this.

There is a reason for it not responding.