• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

networking UDP not sending (solved)

D

Drepple

Guest
Hi there,

I've been working on a game that uses UDP to broadcast data for lobbies and then connects to the server with the lowest ping using TCP. The packets that are being broadcasted only contain a certain time. When another person receives the packet it will send back the time and the person who originally sent it can calculate the ping.
The problem is that the receiver doesn't send the time back. The broadcasting works fine but network_send_udp() returns -2, so it somehow can't send the packet. Here's the code I'm using:

Code:
///scr_send_ping(ip,time)
var ip = argument[0];
var time = argument[1];

buffer_seek(buffer_connect,buffer_seek_start,0);
buffer_write(buffer_connect,buffer_u8,1);
buffer_write(buffer_connect,buffer_u32,time);
var sent = network_send_udp(server,ip,port,buffer_connect,buffer_tell(buffer_connect));
show_debug_message(sent);
buffer_resize(buffer_connect,1);
Does anyone have an idea of what could cause this to happen? FYI: "server" is a TCP type server. I figured it would work for sending UDP messages as well as you also need a TCP server for broadcasting. Thanks in advance
 
D

Drepple

Guest
Oh I figured it out. To anyone having the same problem: You can only send UDP messages with a UDP socket. A bit odd in my opinion, as you need TCP for broadcasting.
 
Top