#how do i make socket receive specific amount of data

4 messages · Page 1 of 1 (latest)

north atlas
#

i have this problem my client is receiving the file name and the file data until that buffer is full i only want it to receive the file name any ideas?

server
send_file_name(filename)
send_data(file data)

client
recv(fille name ) // gets file name and some file data
recv(file data)

iron mango
#

I'd presume you're appending it to an array or Vec, so what about slicing it after the fact instead...??

north atlas
north atlas
#

changing from buf = vec![] to buf = [] fixed it and idk why