Re: INADDR_ANY
On 15 Feb 2006 09:07:26 -0800, "Wenfei" <ye_wenfei@xxxxxxxxxxx> wrote:
addr_in.sin_addr.s_addr = INADDR_ANY;
fprintf("server address is %s\n", inet_ntoa(addr_in.sin_addr));
When I try to see the address as above, it always show me
0.0.0.0. But I know the real address which my server uses is
not 0.0.0.0. How I can know the real address of INADDR_ANY
which is assigned automatically by the machine?
By setting the sin_addr.s_addr member to INADDR_ANY you're not
actually setting it to a real IP address. Just letting the
kernel know that it can use the 'most appropriate address' based
on the route which the packets will traverse. To find out what
that address is, you'll have to actually make a connection, and
then use getsockname() on the socket to find out the socket's
current IP address.
- Giorgos
.
Relevant Pages
- Re: Socket Exception
... In this case the server most likely rejected your ... connection. ... Each command is a new socket connection that is opened and closed ... /// Required designer variable. ... (microsoft.public.win32.programmer.networks) - Re: ASP.NET 2.0 - a newbie question
... Is there some experienced ASP.NET 2.0 developer, ... server that comes bundled Microsoft VWDE. ... A connection attempt failed because the ... connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& ... (microsoft.public.dotnet.framework.aspnet) - error when move web service from dev machine to test server
... I have a simple web service that I developed on my laptop that resides ... test server, & when I try to run it, I get the error "No connection could be ... No connection could be made because the target machine actively refused it ... Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState ... (microsoft.public.dotnet.framework.webservices) - Re: Messaging alert
... I was hopping that I could use sockets to create a connection back and forth in order to send the message. ... I want to be able to send a file name and other information thru the client socket to then process in the servers. ... fileevent $sock w ... At the server side I am listening at the port and execute Accept2 when the socket is created. ... (comp.lang.tcl) - Re: Strange server socket behaviour
... asynchronous server socket: ... I already have a perfectly working server that uses asynchronous sockets ... Why should the remote client close the connection? ... when a .NET client connects. ... (microsoft.public.dotnet.framework) |
|