Req #79507 [NEW]: Ability to determin if socket pers. connection is "new" or already estabilished

From: Date: Wed, 22 Apr 2020 07:13:17 +0000
Subject: Req #79507 [NEW]: Ability to determin if socket pers. connection is "new" or already estabilished
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226710@lists.php.net to get a copy of this message
From: slawek1211 at gmail dot com Operating system: Every operating systems PHP version: Irrelevant Package: Sockets related Bug Type: Feature/Change Request Bug description:Ability to determin if socket pers. connection is "new" or already estabilished Description: ------------ For client-server connections using persistent sockets it's sometimes a desirable functionality to send some initialization data when the connection is initially opened. Fore example to submit feature set supported by client (like compression algorithms supported or client version). As these persistent sockets are managed by PHP it'd be nice to have some function which could be used to assign user data to given socket. This user data would reset when php backend calls connect C function. Or at least some function which would report bytes received and send on $s. This way user can detect if he got new or already estabilished connection in $s. Test script: --------------- $errno = $errstr = 0; $opt_connect_timeout = 5; $s = pfsockopen('127.0.0.1', '80', $errno, $errstr, $opt_connect_timeout); Expected result: ---------------- Being able to write something like this $errno = $errstr = 0; $opt_connect_timeout = 5; $s = pfsockopen('127.0.0.1', '80', $errno, $errstr, $opt_connect_timeout); if (get_socket_user_data($s) != 'i') { ... send connection initialization data to server ... set_socket_user_data($s, 'i'); } -- Edit bug report at https://bugs.php.net/bug.php?id=79507&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79507&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79507&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79507&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79507&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79507&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79507&r=support Expected behavior: https://bugs.php.net/fix.php?id=79507&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79507&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79507&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79507&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79507&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79507&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79507&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79507&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79507&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79507&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79507&r=mysqlcfg

« previous php.bugs (#226710) next »