J
Juzek
Guest
When sending information over my LAN to my server (c++) by building up a buffer, and using network_send_udp(), I cannot interpret what comes across. The server is set up to read in a c++ char* type data, and I would like to be able to send a string (or numbers) that can be interpreted correctly.
When I use the simplest thing I can, ( type buffer_u8) it still gets interpreted as garble, and often receives multiple packets for one variable.
What else does Game Maker Studio send attach to the buffer? is it some sort of indication that this is a game maker variable of type string?
here is my code to send the number 12:
var t_buffer = buffer_create(256, buffer_grow, 1);
buffer_seek(t_buffer,buffer_seek_start, 0);
buffer_write (t_buffer, buffer_u8, 12);
network_send_udp(server_udp,"127.0.0.1",63258,t_buffer,buffer_tell(t_buffer));
Here is what I would like to do, assuming convert_to_c_string was a function:
var t_buffer = buffer_create(256, buffer_grow, 1); buffer_seek(t_buffer,buffer_seek_start, 0);
buffer_write (t_buffer, buffer_string,"command 321 234 1 0");
t_buffer = convert_to_c_string (t_buffer);
network_send_udp(server_udp,"127.0.0.1",63258,t_buffer,buffer_tell(t_buffer));
When I use the simplest thing I can, ( type buffer_u8) it still gets interpreted as garble, and often receives multiple packets for one variable.
What else does Game Maker Studio send attach to the buffer? is it some sort of indication that this is a game maker variable of type string?
here is my code to send the number 12:
var t_buffer = buffer_create(256, buffer_grow, 1);
buffer_seek(t_buffer,buffer_seek_start, 0);
buffer_write (t_buffer, buffer_u8, 12);
network_send_udp(server_udp,"127.0.0.1",63258,t_buffer,buffer_tell(t_buffer));
Here is what I would like to do, assuming convert_to_c_string was a function:
var t_buffer = buffer_create(256, buffer_grow, 1); buffer_seek(t_buffer,buffer_seek_start, 0);
buffer_write (t_buffer, buffer_string,"command 321 234 1 0");
t_buffer = convert_to_c_string (t_buffer);
network_send_udp(server_udp,"127.0.0.1",63258,t_buffer,buffer_tell(t_buffer));