bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#62990: 30.0.50; UDP server closes connection upon receiving an empty


From: Robert Pluim
Subject: bug#62990: 30.0.50; UDP server closes connection upon receiving an empty packet
Date: Mon, 24 Apr 2023 10:51:06 +0200

>>>>> On Fri, 21 Apr 2023 12:36:52 +0200, Vasilij Schneidermann 
>>>>> <mail@vasilij.de> said:

    Vasilij> I'm doing network programming with Emacs Lisp and one of the tasks 
was
    Vasilij> implementing a UDP server reading individual packets. I've found 
that
    Vasilij> when a client sends an empty packet, the server hangs up with a
    Vasilij> connection error and no longer accepts subsequent packets. This 
seems to
    Vasilij> be reasonable behavior for TCP (from what I understand, empty TCP
    Vasilij> messages are a sign of the connection being closed), but
    Vasilij> not for UDP.

Empty TCP messages are perfectly valid, but they should be hidden from
you. recvfrom returning 0 means the connection has been closed, but
thatʼs a separate thing.

Empty UDP messages are also valid, and are indicated by recvfrom returning
0.

Could you show how youʼre generating the empty packets?

    Vasilij> I've attached test programs written in Emacs Lisp and Guile to
    Vasilij> reproduce both correctly and incorrectly functioning servers and 
clients
    Vasilij> respectively. One minor nitpick is that sending an empty UDP 
packet from
    Vasilij> Emacs Lisp doesn't work either, but I'm unsure whether this is a 
bug
    Vasilij> (socat behaves similarly).

Itʼs allowed by the protocol. I guess it could be useful for people
wanting to implement their own keep-alive protocol over UDP.

Robert
-- 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]