Jump to content

socket_recv - not reading all the data


The Little Guy

Recommended Posts

I don't get this...

 

I am using socet_recv, and I don't understand why every time data is sent to the socket, it is unpredictable how much the socket will read... sometimes it reads the whole string, sometimes it reads half, sometime a quarter, and so on.

 

Why does it read like this???

 

Am in shutting down/closing the socket too soon?

 

$max_post_size = 10485760;
socket_recv($client, $headers, $max_post_size, MSG_WAITALL);
socket_getsockname($client, $ip);
$document = new Document($headers);
socket_write($client, $document->result());
socket_shutdown($client, 2);
socket_close($client);

 

I have a form with a textarea, input text filed, and a file field, I am sending all that, to the socket, so the socket is getting all the post data plus a binary string of an image (which i place in the file field, it is about a 66kb size image).

 

any suggestions?

Link to comment
https://forums.phpfreaks.com/topic/179783-socket_recv-not-reading-all-the-data/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.