Jump to content

jmurch

Members
  • Posts

    82
  • Joined

  • Last visited

Everything posted by jmurch

  1. I am reading a stream using '$input = trim(fread($socket, 16384));' and everything is working fine until the length of data from the stream exceeds 4078. At 4078 I stop for some reason reading the stream. I am wondering why this works (up to 4078): '$input = trim(fread($socket, 16384));' But this does not: '$input = stream_get_contents($socket);' Other parameters for the stream are: stream_set_blocking($con, true); stream_socket_enable_crypto($con, true, STREAM_CRYPTO_METHOD_TLS_SERVER); handle_incoming_connection($con, $client); $res = stream_context_create($streamopts); if ($res === false) { System_Daemon::err('error when creating stream'); System_Daemon::stop(); exit(1); } $master = stream_socket_server( "tcp://$host:$port", $errno, $errstr, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $res ); if ($master === false) { System_Daemon::err('stream_socket_server(): [%s] %s', $errno, $errstr ); System_Daemon::stop(); exit(1); } stream_socket_enable_crypto($master, false); function handle_incoming_connection($socket, $client) { $input = trim(fread($socket, 16384)); if (($input == null) || ($input == 'exit') ) { return; } Any help would be greatly appreciated. TIA, Jeff
  2. I want to explode on \n but not for data within double quotes: currently: explode("\n",$decoded_data); Does anyone have any pointers on how to do this? TIA, Jeff
  3. Thanks guys......................!!!!
  4. I'm rying to find a PHP function that will split a binary file to an fixed length chunk into an array other than just using the linux 'split' functionality. 'explode' would work but I need a fixed length chunk not using a delimeter. TIA, Jeff
×
×
  • 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.