php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22808 Wierd fsockopen problem
Submitted: 2003-03-20 16:21 UTC Modified: 2003-03-20 16:31 UTC
From: struman at nuparadigm dot com Assigned:
Status: Not a bug Package: Sockets related
PHP Version: 4.3.0 OS: Windows XP
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: struman at nuparadigm dot com
New email:
PHP Version: OS:

 

 [2003-03-20 16:21 UTC] struman at nuparadigm dot com
Apache 2.0.42 with SAPI module

Default install with sockets module.

When connecting to a java Servlet from PHP. Servlet always reports that port 80 is the port that it is being connected too.

I can telnet to 127.0.0.1 8080 and issue
GET /TestServlet
HTTP/1.0
Host: 127.0.0.1

And the Servlet reports the correct port.

Also reports the correct port when browing URL with Web Browser.

Only in PHP does the port default to 80.

My Guess it that sin_port is being set incorrectly.

-- Test Code  PHP --
$fp = fsockopen("127.0.0.1", 8080, $fsockopen_errnum, $fsockopen_errstr, $fsockopen_timeout);
$sHeader = "GET " . "/TestServlet";
$sHeader .= " HTTP/1.0\r\n";
$sHeader .= "Host: 127.0.0.1\r\n\r\n";
fputs($fp, $sHeader);

-- Servlet Code --
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
System.out.println("Serverport="+request.getServerPort());
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-20 16:31 UTC] struman at nuparadigm dot com
I am able to reproduce the problem with acouple of other client libraries.. not a PHP issue.. Sorry
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 17:01:33 2025 UTC