php.net |  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
Votes:2
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mk75 at sky dot ru
New email:
PHP Version: OS:

 

 [2008-06-22 07:27 UTC] mk75 at sky dot ru
Description:
------------
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://127.0.0.1",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; }
fclose($socket);

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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

UDP is a connection less protocol
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 22:01:26 2024 UTC