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



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


sandeep wrote:
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

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.

HTH
- --
Lew Pitcher



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

iD8DBQFFE9SdagVFX4UWr64RAi/mAJsGJnJ47vZWK8/kELQfGXoQl1Bf+QCbB8gW
lnkSeQAUS4q2u/0OSkzOcB0=
=ykQp
-----END PGP SIGNATURE-----

.



Relevant Pages

  • Re: SetSockOpt with SO_REUSEADDR parameter
    ... So I create multiple UDP sockets with the same port to send data. ... happening is that you are throwing away the old socket and replacing it with the new ... When the second client is connecting to server, I still get the error code ...
    (microsoft.public.vc.mfc)
  • Re: Socket connect vs. bind? What is the difference
    ... Actually, if you're doing UDP Multicast, you don't need to connect. ... to call Connect to establish a TCP connection to the remote IPEndPoint. ... is connectionless, so it isn't even necessary to establish a connection to ... It can be set with an overload of the Socket constructor. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Strange UDP Socket problem
    ... You can catch that exception and move on. ... never get any udp reply back to post an exception. ... >> I suspect you would get the same response if you used one thread to send ... >> thread on same socket. ...
    (microsoft.public.dotnet.languages.csharp)
  • Overhead, UDP: Many packets on 1 socket vs. one packet and many sockets.
    ... gigabit LAN network using UDP. ... information in the data packets. ... Create a new socket for each of these new pieces of data. ...
    (comp.unix.programmer)
  • Re: UDP performance.
    ... issue - it has traditionally been the source of statements like "FreeBSD's threading implementation is weak/bad/broken". ... And these days ISC can't consciously recommend FreeBSD for use on high-traffic DNS servers because UDP performance has gone downhill since 5.x. ... Dinesh> affect voip applications/servers such as asterisk when run on ... One of the problems ISC diagnosed had to do with the highly unusual workload pattern of UDP: many different threads simultaneously sending using a single socket leading to unnecessary socket buffer contention. ...
    (freebsd-performance)