473,395 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

odd fsockopen behavior

Any IP address I try to open with fsockopen on a particular server
seems to use another IP address instead.

eg. I open a socket connection to 192.168.1.1 but the remote_addr that
the other server sees is 192.168.1.255. It's as if, like I said, the
IP address I supply to fsockopen is being replaced with another one.

Anyway, this is breaking a script of mine. I don't think I can really
do a lot in PHP to fix this but is there perhaps some way that I can
detect it? Is there some command line parameter that I can pass to
passthru or something that'll tell me whether or not such a thing is
happening?

Also, how is this even being done? Could a firewall do this? If so,
I'm still not even sure how it'd be done...

May 24 '06 #1
3 1638
>Any IP address I try to open with fsockopen on a particular server
seems to use another IP address instead.

eg. I open a socket connection to 192.168.1.1 but the remote_addr that
the other server sees is 192.168.1.255. It's as if, like I said, the
IP address I supply to fsockopen is being replaced with another one.
NAT in a firewall or router?
Using a broadcast address for this is kinda wierd.

Describe your network topology, including all the routers and switches.
Anyway, this is breaking a script of mine. I don't think I can really
do a lot in PHP to fix this but is there perhaps some way that I can
detect it?
If there's NAT in use, you can't detect this just from the
server end. You'd have to ask (and trust) the client end to
give you what *it* thinks the IP address is. But Javascript
is often Turned Off (tm).
Is there some command line parameter that I can pass to
passthru or something that'll tell me whether or not such a thing is
happening?

Also, how is this even being done? Could a firewall do this? If so,
I'm still not even sure how it'd be done...


A firewall with NAT could definitely do this, although it seems its
configuration is a bit wierd.

Gordon L. Burditt
May 24 '06 #2

Gordon Burditt wrote:
<snip>
NAT in a firewall or router?
Using a broadcast address for this is kinda wierd.

Describe your network topology, including all the routers and switches. It's remote web hosting on the GoDaddy.com hosting servers. Beyond
that, I don't know...
If there's NAT in use, you can't detect this just from the
server end. You'd have to ask (and trust) the client end to
give you what *it* thinks the IP address is. But Javascript
is often Turned Off (tm).

Wouldn't using a SOCKS proxy or something yield false positives in that
case?

Also, would the gateway computer be the one responsible for the NAT?

May 24 '06 #3
>> <snip>
NAT in a firewall or router?
Using a broadcast address for this is kinda wierd.

Describe your network topology, including all the routers and switches.It's remote web hosting on the GoDaddy.com hosting servers. Beyond
that, I don't know...


If these servers are available for surfing to the public, and the
addresses you gave are real, there *MUST* be some NAT in there
somewhere, as the addresses are private ones, and the general public
can't route to them.
If there's NAT in use, you can't detect this just from the
server end. You'd have to ask (and trust) the client end to
give you what *it* thinks the IP address is. But Javascript
is often Turned Off (tm).

Wouldn't using a SOCKS proxy or something yield false positives in that
case?


Yes, although it's unclear in my mind whether that would be a FALSE
positive or a TRUE positive.
Also, would the gateway computer be the one responsible for the NAT?


Nobody said the gateway is a computer. It might be a Cisco router,
or a DSL modem/router.

Gordon L. Burditt
May 25 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chris | last post by:
Hi All, I've been puzzling over this, but can't find a satisfactory answer anywhere. I'm not sure if the problem is in my code, or if it's something to do with the PHP/Apache set-up (probably...
1
by: Michael T. Peterson | last post by:
I'm having trouble understanding why fsockopen() returns null yet the errstring/errno value yields: "The operation completed successfully. (0)" Here's the code (modified from an example found...
5
by: Jesse | last post by:
I'm having issues attempting to create an ssl connection using fsockopen. my code contains the following line . fsockopen("ssl://siteaddr",993,$errno,$errmsg,20); error message reported:...
2
by: Loopy | last post by:
I'm trying to write a script that will connect to an external site so that I can get access referer information in a database on another one of my sites. I got errors, so I tried to write a script...
9
by: fipaj1992 | last post by:
Hi! I have very big problem with fsockopen() function. It is very important... That's code: <?php $test = fsockopen ('chrome.pl', '8080'); ?>
1
by: Syl | last post by:
Hi group - I have a database table with 4 columns that hold a url. I am selecting each url and I need to check to see if it is valid. I assumed I could use the fsockopen command. I've had to...
8
by: Yoko | last post by:
So I am using php version 4.3.9 and lets say i have a file on the server called tester.php so i am using fsockopen to point to that file but it gives me a error below. $fh =...
6
by: henryrhenryr | last post by:
Hi I'm really hoping for some ideas! I have been setting up phpmailer on my server and it was working nicely on my local server so I uploaded to my live server and tested. The mystery is that...
5
by: aswathip | last post by:
I am new to sockets and fsockopen(). I am trying to send SMS using a gateway. But the fsockopen always shows the following error. Warning: fsockopen() : unable to connect to alertbox.in:80 (A...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.