• 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!

Windows buffer is empty?

E

erfg12

Guest
Debug says buffer is blank and nothing is getting sent to my server beyond a connection was successful message.

client_socket = network_create_socket(network_socket_tcp);

if (network_connect_raw(client_socket,"127.0.0.1",13000) >=0){
t_buffer = buffer_create(4, buffer_fixed, 1);
buffer_seek(t_buffer, buffer_seek_start, 0);
buffer_write(t_buffer, buffer_string, "hi");
var buff_content = buffer_read(t_buffer, buffer_string );
show_debug_message(buff_content);
network_send_raw(client_socket,t_buffer,buffer_tell(t_buffer));
}

//buffer_delete(t_buffer);

 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
By least, your test code produces an empty string because you do not rewind the buffer before starting to read.

Other thing that's suspicious is that you create a fixed-sized buffer -- strings will usually simply not write if a buffer can't fit them.
 
E

erfg12

Guest
@YellowAfterlife thank you for the reply. Placing the buff_seek after the write worked like you said. buffer_content is showing "hi" now.

But I'm not seeing any data come over to my server. My server is showing a connection, but placing a breakpoint on my read function shows nothing being sent over. Does the network_send_raw look correct?

client_socket = network_create_socket(network_socket_tcp);

var t_buffer = buffer_create(4, buffer_fixed, 1);
buffer_write(t_buffer, buffer_string, "hi");
buffer_seek(t_buffer, buffer_seek_start, 0);
var buff_content = buffer_read(t_buffer, buffer_string );
var buff_size = buffer_get_size(t_buffer);

if (network_connect_raw(client_socket,"127.0.0.1",13000) >=0){
show_debug_message("connected successfully");
}

if (network_send_raw(client_socket,t_buffer,buffer_tell(t_buffer)) >=0){
show_debug_message("msg sent successfully");
}

connected successfully
msg sent successfully

Nothing was received.
 
Last edited by a moderator:
Top