Impact of bind() on recvfrom() and sendto() - Networking

This is a discussion on Impact of bind() on recvfrom() and sendto() - Networking ; Assume a UDP socket S on a machine with more than one interface card, let's say two interface cards with IP addresses IP1 and IP2. Also assume that you bind the socket S to IP1 and port P1. Does it ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Impact of bind() on recvfrom() and sendto()

  1. Impact of bind() on recvfrom() and sendto()

    Assume a UDP socket S on a machine with more than one interface card,
    let's say two interface cards with IP addresses IP1 and IP2.
    Also assume that you bind the socket S to IP1 and port P1.

    Does it mean that recvfrom() on socket S will not receive any data
    that came in
    on interface card with IP2 for port P1?

    Does it mean that sendto() will send all datagrams through interface
    card with IP1
    regardless of the target address? What if this conflicts with the
    route table?


  2. Re: Impact of bind() on recvfrom() and sendto()

    maruk2@hotmail.com wrote:
    > Assume a UDP socket S on a machine with more than one interface
    > card, let's say two interface cards with IP addresses IP1 and IP2.
    > Also assume that you bind the socket S to IP1 and port P1.


    > Does it mean that recvfrom() on socket S will not receive any data
    > that came in on interface card with IP2 for port P1?


    When a UDP datagram arrives, it will be handed to the UDP endpoint
    with the closest match on local/remote IP, local/remote port -
    _without_ any conflicting fields.

    > Does it mean that sendto() will send all datagrams through interface
    > card with IP1 regardless of the target address? What if this
    > conflicts with the route table?


    All it does in this context is specify the source IP.

    rick jones
    --
    The glass is neither half-empty nor half-full. The glass has a leak.
    The real question is "Can it be patched?"
    these opinions are mine, all mine; HP might not want them anyway...
    feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...

+ Reply to Thread