I got a server with several of IP's at. Those IP's I want to create sockets through and afterwards from a client, and afterwards send a socket to a webpage.
The problem is that I want to use the IP that the client is calling to create the socket to the webpage, and not just the main IP of the server.
Etc, I connect from client to:
xx.xx.xx.45
and then I create a socket to a webserver using,
s.bind((gethostname(), 1700))
s.connect(addr)
but that binding will attach it to the main IP: xx.xx.xx.12 and not xx.xx.xx.45 which is the IP I wans to bind to the webserver socket.
Is there any solution of how I can recall the IP that I created the socket through so I not just get the main IP of the server?
I have like 150+ different IP's I want to use and create sockets through. If I have to provide it everytime there will be a lot of hardcoding.
Would do it much easier if there is a way to recall the IP that the server was called at.
Yeah but the problem aint that I dont know if the server can create the socket. So I dont see any reason to use try and except.
The problem is that I connect to etc. xx.xx.xx.42 and then I also wants to bind that IP to the socket. But I dont know how to recall that IP, when I etc use gethostbyadress or anything else I get the main IP of the server that is xx.xx.xx.12
Sure. I want to be able to send a socket message with from a PHP script on my webserver with a HTTP header to a specific IP on the server.
Then the IP I call in the socket needs needs to bind it self to the webserver and send the message it recieves from my php script.
So kind of a proxy where I can be able to use all the IP's on the server if just I am able to recall the right IP again :)