473,545 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
+ 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:<01100011 001011100110001 001110101011100 10011010110
110010101000000 011000110111001 001100001011110 10011011100
110000101110010 001011100110001 101101111011011 0100100000>
Jul 17 '05 #1
3 3125
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:<01100011 001011100110001 001110101011100 10011010110
110010101000000 011000110111001 001100001011110 10011011100
110000101110010 001011100110001 101101111011011 0100100000>
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:<01100011 001011100110001 001110101011100 10011010110
110010101000000 011000110111001 001100001011110 10011011100
110000101110010 001011100110001 101101111011011 0100100000>
Jul 17 '05 #4

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

Similar topics

2
2718
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 socket module. Everything works fine, as long as I'm trying to connect to the server from the host, the server is running. If I try to access the...
6
4281
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 as I can tell the problem is they are using a DSL modem with a router internal to it. So basically my software is listening to IP address 10.0.0.3...
4
2137
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 = new TcpListener(8080); mainTcp.Start();
0
2038
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 got in C# -------------------------------------------------------------------------- listeningSock = new Socket(AddressFamily.InterNetwork,...
2
3478
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 managed). I create a server socket, and then listen on it. I then accept a new connection from that server socket. If I now close the server...
6
3096
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 to access a socket in a way fobidden by its access permissions."
10
5147
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 always raise a OnConnect event (actually, it calls the callback function as if there was a new connection attempt) and I receive a...
5
4405
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
4324
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 != true) { TcpListener tcplistener = new TcpListener(port);
0
7680
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7934
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7446
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7778
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5349
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4966
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3476
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1908
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
731
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.