INADDR_ANY IP and 127.0.0.1 - Programmer

This is a discussion on INADDR_ANY IP and 127.0.0.1 - Programmer ; Hi all, I'm not really sure that I understood the difference to bound a server socket (listening socket) to INADDR_ANY, or to use it's own IP (i.e.: 129.168.22.23) or to use 127.0.0.1. I know that INADDR_ANY makes sense when the ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: INADDR_ANY IP and 127.0.0.1

  1. INADDR_ANY IP and 127.0.0.1

    Hi all,

    I'm not really sure that I understood the difference to bound a server
    socket (listening socket) to INADDR_ANY, or to use it's own IP (i.e.:
    129.168.22.23) or to use 127.0.0.1.
    I know that INADDR_ANY makes sense when the machine is having more than
    one network interfaces, but what I'm not sure is what is the difference
    between the above ones?
    And what happens if a client from the _same_ machine is trying to
    connect to the server either by using: IP (ie 192.168.22.23) or
    127.0.0.1?

    Maybe somebody can explain me?

    Thx,
    Viv

  2. Re: INADDR_ANY IP and 127.0.0.1

    hi ,
    as far as I know , no machine have an ip "127.0.0.1 " on any network.This ip
    is loopback address . Others cant use this address to connect to you. so
    others must use 129.168.22.23 to connect to you .
    I advise you (and to me to read class Id and net ids.
    note : maybe, the information I just gave can be wrong, wait for another
    answer.

    "Viviana Vc" wrote in message
    news:2h6to0F9kutfU1@uni-berlin.de...
    > Hi all,
    >
    > I'm not really sure that I understood the difference to bound a server
    > socket (listening socket) to INADDR_ANY, or to use it's own IP (i.e.:
    > 129.168.22.23) or to use 127.0.0.1.
    > I know that INADDR_ANY makes sense when the machine is having more than
    > one network interfaces, but what I'm not sure is what is the difference
    > between the above ones?
    > And what happens if a client from the _same_ machine is trying to
    > connect to the server either by using: IP (ie 192.168.22.23) or
    > 127.0.0.1?
    >
    > Maybe somebody can explain me?
    >
    > Thx,
    > Viv




  3. Re: INADDR_ANY IP and 127.0.0.1


    INADDR_ANY : anyone from any network can connect, using any IP address bound
    to the PC.

    127.0.0.1 : only the programs/users of same PC can connect, and only using
    the address 127.0.0.1

    other : connections can be made to this address. (users/programs on same PC
    can not connect using 127.0.0.1).

    best solution for most server software (in my mind) : allow multiple
    bindings. ie, allow the user to secify a list of IPs they wish to bind on.
    (default to just a single one of 0.0.0.0). this will require you to bind(),
    listen(), accept() on a list/arry of sockets.

    then a user could for example specify '192.168.0.1 & 127.0.0.1' to traffic
    to non routable/public addresses.

    --
    Louis Solomon
    www.steelbytes.com


    "Viviana Vc" wrote in message
    news:2h6to0F9kutfU1@uni-berlin.de...
    > Hi all,
    >
    > I'm not really sure that I understood the difference to bound a server
    > socket (listening socket) to INADDR_ANY, or to use it's own IP (i.e.:
    > 129.168.22.23) or to use 127.0.0.1.
    > I know that INADDR_ANY makes sense when the machine is having more than
    > one network interfaces, but what I'm not sure is what is the difference
    > between the above ones?
    > And what happens if a client from the _same_ machine is trying to
    > connect to the server either by using: IP (ie 192.168.22.23) or
    > 127.0.0.1?
    >
    > Maybe somebody can explain me?
    >
    > Thx,
    > Viv




  4. Re: INADDR_ANY IP and 127.0.0.1

    Thanks to all of you for your answers. It helped indeed.

    Thx,
    Viv


    On Mon, 24 May 2004 13:14:45 +1000, "Louis Solomon [SteelBytes]"
    wrote :

    >
    >INADDR_ANY : anyone from any network can connect, using any IP address bound
    >to the PC.
    >
    >127.0.0.1 : only the programs/users of same PC can connect, and only using
    >the address 127.0.0.1
    >
    >other : connections can be made to this address. (users/programs on same PC
    >can not connect using 127.0.0.1).
    >
    >best solution for most server software (in my mind) : allow multiple
    >bindings. ie, allow the user to secify a list of IPs they wish to bind on.
    >(default to just a single one of 0.0.0.0). this will require you to bind(),
    >listen(), accept() on a list/arry of sockets.
    >
    >then a user could for example specify '192.168.0.1 & 127.0.0.1' to traffic
    >to non routable/public addresses.



  5. Re: INADDR_ANY IP and 127.0.0.1

    In article <2h6to0F9kutfU1@uni-berlin.de>, vcotirlea@hotmail.com says...
    > Hi all,
    >
    > I'm not really sure that I understood the difference to bound a server
    > socket (listening socket) to INADDR_ANY, or to use it's own IP (i.e.:
    > 129.168.22.23) or to use 127.0.0.1.
    > I know that INADDR_ANY makes sense when the machine is having more than
    > one network interfaces, but what I'm not sure is what is the difference
    > between the above ones?
    > And what happens if a client from the _same_ machine is trying to
    > connect to the server either by using: IP (ie 192.168.22.23) or
    > 127.0.0.1?
    >
    > Maybe somebody can explain me?
    >
    > Thx,
    > Viv
    >

    Using INADDR_ANY is useful if you want to receive a broadcast datagram
    prior to actually installing an IP address on thr adapter (See DHCP
    protocol for an example).

    --
    Wim Morrison
    abuse@html.com.au

+ Reply to Thread