note 126286 added to function.socket-write

From: Date: Thu, 29 Jul 2021 00:52:22 +0000
Subject: note 126286 added to function.socket-write
Groups: php.notes 
Request: Send a blank email to php-notes+get-216677@lists.php.net to get a copy of this message
sending a few mbs or more results in incomplete transfers, send data in a loop and chunks instead, socket_write reports complete write even though it is only a partial transfer, possibly because of buffer overrun somewhere. $strlen=strlen($msg); $totaltransferred=0; $blocksize=10000; for ($a=0;$a<$strlen;$a+=$blocksize){ $part=substr($msg,$a,$blocksize); $transferred=socket_write($socket,$part,strlen($part)); $totaltransferred+=$transferred; } if ($totaltransferred<$strlen){ echo "incomplete transfer"; } ---- Server IP: 45.112.84.4 Probable Submitter: 45.112.85.242 (proxied: 94.54.64.154) ---- Manual Page -- https://php.net/manual/en/function.socket-write.php Edit -- https://main.php.net/note/edit/126286 Del: integrated -- https://main.php.net/note/delete/126286/integrated Del: useless -- https://main.php.net/note/delete/126286/useless Del: bad code -- https://main.php.net/note/delete/126286/bad+code Del: spam -- https://main.php.net/note/delete/126286/spam Del: non-english -- https://main.php.net/note/delete/126286/non-english Del: in docs -- https://main.php.net/note/delete/126286/in+docs Del: other reasons-- https://main.php.net/note/delete/126286 Reject -- https://main.php.net/note/reject/126286 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#216677) next »