From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#62990: 30.0.50; UDP server closes connection upon receiving an empty packet Date: Mon, 24 Apr 2023 10:51:06 +0200 Message-ID: <87wn21br45.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39877"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 62990@debbugs.gnu.org To: Vasilij Schneidermann Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 24 10:52:19 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pqrvm-000A9g-Pp for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 24 Apr 2023 10:52:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqrvZ-0001Q1-CD; Mon, 24 Apr 2023 04:52:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqrvW-0001Pn-MX for bug-gnu-emacs@gnu.org; Mon, 24 Apr 2023 04:52:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pqrvW-0004bc-39 for bug-gnu-emacs@gnu.org; Mon, 24 Apr 2023 04:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pqrvV-00056C-US for bug-gnu-emacs@gnu.org; Mon, 24 Apr 2023 04:52:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Apr 2023 08:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62990 X-GNU-PR-Package: emacs Original-Received: via spool by 62990-submit@debbugs.gnu.org id=B62990.168232627719363 (code B ref 62990); Mon, 24 Apr 2023 08:52:01 +0000 Original-Received: (at 62990) by debbugs.gnu.org; 24 Apr 2023 08:51:17 +0000 Original-Received: from localhost ([127.0.0.1]:47463 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqrum-00052D-By for submit@debbugs.gnu.org; Mon, 24 Apr 2023 04:51:16 -0400 Original-Received: from mail-wr1-f43.google.com ([209.85.221.43]:57733) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqruk-00051N-47 for 62990@debbugs.gnu.org; Mon, 24 Apr 2023 04:51:14 -0400 Original-Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-2fa0ce30ac2so3774725f8f.3 for <62990@debbugs.gnu.org>; Mon, 24 Apr 2023 01:51:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682326268; x=1684918268; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=r4j7iKSK+9RNdJP6dJ4k4DUprwohLaazuaNUHD4mO3A=; b=mvwrAgg8hjchtda4k5D/qMYqfCQK/iinsSDkgtb4nZArT++MUUQce8M3fEmjelSl1E s0tU6WMXECVYf7EzoJpZPXyvcGz+2DSWiP0FE0p9KfqBVdtxMjKfRJWRIhe1NAAe2Gc4 gicQgxRZb7gtJWJzmssH61N8i2uqxDPGOCIYxNfi4Z81B2GPcaD292K/ilKu+Q6j4m22 UBi76XcHXXTIlOEDc+s1EghHOXbHZp/rxCw0S9ZfnPVEznQkFoLqt+Ki31D3aqiqWduQ 1ez4ZyNq4QKF/2gVepfSmkLMy7jt6hyaZmOW/jiX6CJxS3oUZYTfpqI/GXjvpCtl9JRg n53g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682326268; x=1684918268; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r4j7iKSK+9RNdJP6dJ4k4DUprwohLaazuaNUHD4mO3A=; b=BXf55ihcZiC6/DV61ksa2vvwFq5hYr48WNBmQLdKmYbSF/pB+uQYM+mAChF1p5ACyp PQYjuNdlnEjaMb9AM61tVdLoq2oR1sYsHEZ+hRuM4DPTa2tAuYRK/h5XerE/DB1uqG3a VH1u6SfhaXl55eyevpJE3/JmTEWxG/3k2maLzQ3tDF2xqo4zRsCNFXR7Z2TGDAct0TkU xxdcw/+gCVDbg2YSLNqRg+alDDBpeJrd3MnySZdRkz/hirF+ccSZXJP3c4sRruGwyyJq wBKNfobj3ya53GHLOg7VubTcPCZM0xiBWNWEavXM0Dbqo7/O5cRGiuJIQNkax1tmdAOO YQzg== X-Gm-Message-State: AAQBX9eIVmslnKzQZpyzC2Qywgcj+KRE2c1texZtQwLGi/0ThikYNgcs d92KOn596YuNjfAwnBauUq1XHul/ehM= X-Google-Smtp-Source: AKy350YoToM7ZTKz8yIByuXtXyw5J0L9FmWhmnYHB2VWSqEtNcY1B4sjhhpOjtWv+CNvyXH1DJNAJg== X-Received: by 2002:adf:cf0d:0:b0:2f1:e162:d48 with SMTP id o13-20020adfcf0d000000b002f1e1620d48mr8995491wrj.47.1682326267766; Mon, 24 Apr 2023 01:51:07 -0700 (PDT) Original-Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id m10-20020a5d56ca000000b002c54c9bd71fsm10291434wrw.93.2023.04.24.01.51.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Apr 2023 01:51:07 -0700 (PDT) In-Reply-To: (Vasilij Schneidermann's message of "Fri, 21 Apr 2023 12:36:52 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:260551 Archived-At: >>>>> On Fri, 21 Apr 2023 12:36:52 +0200, Vasilij Schneidermann said: Vasilij> I'm doing network programming with Emacs Lisp and one of the t= asks was Vasilij> implementing a UDP server reading individual packets. I've fou= nd that Vasilij> when a client sends an empty packet, the server hangs up with a Vasilij> connection error and no longer accepts subsequent packets. Thi= s 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=CA=BCs a separate thing. Empty UDP messages are also valid, and are indicated by recvfrom returning 0. Could you show how you=CA=BCre 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 a= nd clients Vasilij> respectively. One minor nitpick is that sending an empty UDP p= acket from Vasilij> Emacs Lisp doesn't work either, but I'm unsure whether this is= a bug Vasilij> (socat behaves similarly). It=CA=BCs allowed by the protocol. I guess it could be useful for people wanting to implement their own keep-alive protocol over UDP. Robert --=20