|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45329 Bug with opening udp socket on localhost
Submitted: 2008-06-22 07:27 UTC Modified: 2008-06-22 21:37 UTC
Avg. Score:2.0 ± 1.0
Reproduced:1 of 2 (50.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: mk75 at sky dot ru Assigned:
Status: Not a bug Package: Sockets related
PHP Version: 5.2.6 OS: Windows XP SP2
Private report: No CVE-ID: None
 [2008-06-22 07:27 UTC] mk75 at sky dot ru
Hello. I opening udp socket on my ip adress  on closed port and fsock open don't return error, but when i trying make fread after fwrite i've got error reading socket.

Reproduce code:
function STAT_PACKET()
    $packet = pack("H*","FFFFFFFF");
    $packet .= "TSource Engine Query";
    $packet .= pack("H*","00");
    return $packet;
if (!$socket=fsockopen("udp://",324,$errno,$errstr,2))
    die("Error opening socket: $errstr<br>Code of error: $errno");
fwrite ($socket,STAT_PACKET());
if (!$buff=fread ($socket,1000)){echo "Error reading socket";return false;} ;
$buffer = trim(substr($buff, 4));
if (!trim($buffer)) { echo "error";return false; }

Expected result:
Code print Error reading socket and return false then exit.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-22 10:14 UTC] mk75 at sky dot ru
Changed type of bug
 [2008-06-22 21:37 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

UDP is a connection less protocol
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Jan 18 08:03:18 2022 UTC