S
Shadowblitz16
Guest
can someone give me an example of how to test for a connection and disconnection in udp?
I wanted to bypass the server object directly and just have everything in the client object and have it auto detect which is the server, however since its a connectionless protocol I'm not sure how to test if someone had disconnected or connected.
I wanted to bypass the server object directly and just have everything in the client object and have it auto detect which is the server, however since its a connectionless protocol I'm not sure how to test if someone had disconnected or connected.
Code:
/// @description Create Server
var type = network_socket_udp;
var port = 8000;
socket = network_create_socket_ext(type, port);
remote_port = 0;
remote_ip = "0.0.0.0";
send_buffer = buffer_create(1024, buffer_fixed, 1);
Code:
/// @description Sync Server
var type = async_load[? "type"]
switch(type)
{
case network_type_connect:
remote_port = async_load[? "port"];
remote_ip = string(async_load[? "ip"])
break;
}
var buffer = async_load[? "buffer"]
buffer_seek(buffer, buffer_seek_start,0);
process_packet(buffer);