How to find UDP socket is closed in client and server program in C

Discussion in 'Linux Networking' started by sandeep, Sep 22, 2006.

  1. sandeep

    sandeep Guest

    In tcp/ip we can find socket is close by recv( ) returns zero but in
    UDP how to find socket is closed other end in client and server program
    in C
    sandeep, Sep 22, 2006
    1. Advertisements

  2. sandeep

    Lew Pitcher Guest

    Hash: SHA1

    You cant.

    At least, not without explicit assistance from the application code
    that opened the socket. The "closer" will have to explicitly notify the
    other party that it is no longer going to send datagrams. This
    notification /can/ be in the form of a datagram (i.e. an "I'm done"
    message), but it is not a requirement. The other party must also be
    able to handle the notification that the "closer" provides. It's
    simpler to just assume that the sender always closes immediately after
    the datagram is sent. UDP is, after all, a connectionless protocol, and
    this assumption would be consistant with the behaviour of a
    connectionless protocol.

    - --
    Lew Pitcher

    Version: GnuPG v1.4.3 (MingW32) - WinPT 0.11.12

    -----END PGP SIGNATURE-----
    Lew Pitcher, Sep 22, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.