1

Can I increase the packet size in php from php.ini file?

I need to send larger packets.

PHP is blocking me and giving an error:

Warning: socket_write() [function.socket-write]: unable to write to socket [0]: A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram into was smaller than the datagram itself.

Any suggestions?

The code is:

$con=file_get_contents("image url");

$binary_data=base64_encode($con);

            $host = "123.456.78.9";
            $port = 1060;
            $message = $binary_data;
            // No Timeout 
            set_time_limit(0);


            $socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP) or die("Could not create socket\n");

            socket_connect($socket, $host, $port) or die("Could not connect to server\n");

            socket_write($socket, $message, strlen($message)) or die("Could not send data to server\n");
Brute Force
  • 464
  • 4
  • 15
  • Can you show your code? – hek2mgl Apr 09 '13 at 18:24
  • 1
    You may have to manage the buffer yourself. What OS? Do you actually need larger packets themselves? Can't you leave the fragmentation up to the lower layers? – Brad Apr 09 '13 at 18:24
  • I need to keep the packet as one whole packet because I am using UDP. If I segment the packet and send it I have to worry "if the packet is received on the server side?" and also worry "if segments are in the right order?". – Brute Force Apr 09 '13 at 18:30
  • Could it be done from the php.ini file? The max size I need to send is 1MB only – Brute Force Apr 09 '13 at 18:31
  • Its likely you will have to write each packet – datasage Apr 09 '13 at 18:40

0 Answers0