473,480 Members | 3,796 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Create a listening socket in PHP ?

How does one go about creating a listening socket in a PHP script.

I'm trying to work out a way of finding out my IP address (dynamic,
behind NAT) and I can't use the normal http idea to get it (due to
stuff proxy by ISP).

SO what I thought was to write a protected PHP script which listend for
ONE request on that port - and send back the IP bound on that port.

So from my linux box I would:

1. GET http://xyz.com/wait.php?port=2002
2. telnet xyz.com 2002

Thus geting my IP address ...

Any ideas ?

--
Spam:newsgroup(at)cr*********@verisign-sux-klj.com
EMail:<0110001100101110011000100111010101110010011 010110
11001010100000001100011011100100110000101111010011 011100
11000010111001000101110011000110110111101101101001 00000>
Jul 17 '05 #1
3 3122
Hi,

127.0.0.1 wrote:
How does one go about creating a listening socket in a PHP script.

I'm trying to work out a way of finding out my IP address (dynamic,
behind NAT) and I can't use the normal http idea to get it (due to
stuff proxy by ISP).

SO what I thought was to write a protected PHP script which listend for
ONE request on that port - and send back the IP bound on that port.

So from my linux box I would:

1. GET http://xyz.com/wait.php?port=2002
2. telnet xyz.com 2002

Thus geting my IP address ...

Any ideas ?


Why not just look at the X-Forwarded-For: and Via: headers?

Luke

Jul 17 '05 #2
Luke Ross wrote:
1. GET http://xyz.com/wait.php?port=2002
2. telnet xyz.com 2002

Thus geting my IP address ...

Any ideas ?


Why not just look at the X-Forwarded-For: and Via: headers?


This isn't an e-mail issue ... I want to write a script that runs on my
home linux box that finds out the IP address to send to the DNSMadeEasy
folk and my DDNS entry there.

I'm finding it absolutely amazing that there is no easy way of doing
that... so I am trying out other ways ... including PHP.

--
Spam:newsgroup(at)cr*********@verisign-sux-klj.com
EMail:<0110001100101110011000100111010101110010011 010110
11001010100000001100011011100100110000101111010011 011100
11000010111001000101110011000110110111101101101001 00000>
Jul 17 '05 #3
Luke Ross wrote:
Thus geting my IP address ...

Any ideas ?


Why not just look at the X-Forwarded-For: and Via: headers?


It is a translucent proxy, I don't actually have an IP address for the
proxy in a reliable fashion, and the proxy doesn't reliably pass on my
IP address. Also - the headers will tend to have my private-ip address
in them anyway.... not the public IP which is the one I want to find
out.

--
Spam:newsgroup(at)cr*********@verisign-sux-klj.com
EMail:<0110001100101110011000100111010101110010011 010110
11001010100000001100011011100100110000101111010011 011100
11000010111001000101110011000110110111101101101001 00000>
Jul 17 '05 #4

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

Similar topics

2
2711
by: Christian von Essen | last post by:
Hi, As I don't know if my problem is python, platform or non-specific, I try to post my question here, as you may have made similar experiences. I try to write a simple chatserver, using the...
6
4266
by: John J. Hughes II | last post by:
My code starts a TCP/IP socket listener and waits for incoming connections. This works fine on my system and my test system but I have a customer who say it does not work on their system. As far...
4
2132
by: Xarky | last post by:
Hi, I am writing a small web server, to listen on web browser port(8080), if I'm not wrong. Basically for parsing some tags found in html. Now I am doing as follows TcpListener mainTcp =...
0
2018
by: Vladimir Lushnikov | last post by:
Hi, I'm experimenting with the Seqpacket protocol, because the connectionless protocols aren't enough for my needs, and TCP/IP doesn't preserve message boundaries. This is what I've currently...
2
3468
by: Lenard Gunda | last post by:
Hi, I have the following problem when I am working with sockets in C#. I do not remember running into the same problem some while ago, when working with sockets from C++ (using native code, not...
6
3088
by: kai | last post by:
Hi, I was tring to run an example (HelloWorld.aspx) from MSPrss book, I get this message: "ASP.NET Development Server faild to start listening port 1034. Error message: An attempt was made...
10
5137
by: ThunderMusic | last post by:
Hi, I'm currently working with sockets. I accept connections using m_mySocket.Listen(BackLogCount); But when I want to stop listening, I shutdown all my clients and call m_mySocket.Close(), but it...
5
4395
by: rome ez | last post by:
I am trying to write a vb.net socket application which listens for clients on two ports simultaneously. Is it possible to do so and how can this be done. Please help.
15
4316
Kevinyy
by: Kevinyy | last post by:
What am i doing wrong here? //other class/methods above here private void btnStartS_Click(object sender, EventArgs e) { const int port = 9919; if (islistening...
0
6905
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
7041
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7080
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...
1
6736
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
6908
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...
1
4772
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4478
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2994
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
178
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.