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.devel Subject: Re: UDP: Send and receive on same port? Date: Wed, 31 Mar 2021 11:14:11 +0200 Message-ID: <878s634rdo.fsf@gmail.com> References: <87mtulxbko.fsf@blind.guru> <87a6qkew0c.fsf@blind.guru> <87pmzg4qd4.fsf@gmail.com> <878s64e4ld.fsf@blind.guru> 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="22771"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Mario Lang Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Mar 31 11:16:07 2021 Return-path: Envelope-to: ged-emacs-devel@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 1lRWxK-0005P9-0M for ged-emacs-devel@m.gmane-mx.org; Wed, 31 Mar 2021 11:16:06 +0200 Original-Received: from localhost ([::1]:53244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lRWxI-0003JJ-LX for ged-emacs-devel@m.gmane-mx.org; Wed, 31 Mar 2021 05:16:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42502) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRWvY-0002Xi-Nd for emacs-devel@gnu.org; Wed, 31 Mar 2021 05:14:16 -0400 Original-Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:37804) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lRWvW-00047o-Ra for emacs-devel@gnu.org; Wed, 31 Mar 2021 05:14:16 -0400 Original-Received: by mail-wr1-x434.google.com with SMTP id x16so18870062wrn.4 for ; Wed, 31 Mar 2021 02:14:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:gmane-reply-to-list:date:in-reply-to :message-id:mime-version:content-transfer-encoding; bh=HipdSvX6dUU/nYc9tMP85hc2JFdMyGKQ5Qr7d+S4ybs=; b=NdM/lY99SUQ8/SxIfV89bW/fewXE6uiiSuD1F1RgrBWTS5FBQIjUd1TA1OESrzNMO1 EHIuk6LJE29+RGUabwENiD7+smQjcaFrdHdC3/iUmBT4mi+a15gF+sPf6rhopy0fmY2N dsW7IBLAzxcKsvsmGSPqExzMzyNQ1ZYYG2tt7YQZCj+74DNZbOT+YgzbYCPBkIkK4idZ LXfxc4F9f0iWKMg4/KsjSW6knDyDwlGE4iomR085HLxl2SknCts9h8gidbEmuP9uZj5U m9jhSzGdgUHDq5TTKOl3oVCj5o+oVzoH2UblAfPz4lyL5xgxcT/XFvIrPAVSoa5SXeU5 3/6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references :gmane-reply-to-list:date:in-reply-to:message-id:mime-version :content-transfer-encoding; bh=HipdSvX6dUU/nYc9tMP85hc2JFdMyGKQ5Qr7d+S4ybs=; b=kKk9dRY5ziwoyN3qr7/kEbVTNUIklw8GmtOXuy5dH7iMEHX6SNvS8BiXq7dVnx3c9p LxQFWmubflooUu6Ox8v6TYS9ZkQWAeMMu35aL7CSZcsREq1g7dZ06rYQBthawfiXG5EX bo59GolPx/WoY0tDQFF4FZRHaGZMI5+Bu4OVvazADVz2M8hy9ic5fFRCFixxn5E8Nqa4 HkpVOLVMaYdewpS7VBwJwUzwD6q4GO2QfqRS0BCWaLi2saLFGoIljMNeD4JC5qVvOpge RS1FnZLUk5q3TIN2ud9fallPoF+T7JFjfAjVZHLijTjXL9mfoFugDW3deStEWjsMAQet jUYg== X-Gm-Message-State: AOAM530UM3nRt4QJQdKm46Y3QypVBGsAMlKvL4KPiX76yhOX8IA2ExUx V88MPFeLhDyau1h5Bojb0kzbkTm/g00= X-Google-Smtp-Source: ABdhPJxCv7Sg9Y4ayHhzS3rqm4Q9R3gS4M+KS9sA/+JAiK2aELtETXZI3dyYiOs6d+FKORcOCjGKGA== X-Received: by 2002:a5d:42ca:: with SMTP id t10mr2476496wrr.274.1617182052636; Wed, 31 Mar 2021 02:14:12 -0700 (PDT) Original-Received: from rltb (91-175-207-237.subs.proxad.net. [91.175.207.237]) by smtp.gmail.com with ESMTPSA id z8sm3222806wrh.37.2021.03.31.02.14.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Mar 2021 02:14:11 -0700 (PDT) Gmane-Reply-To-List: yes In-Reply-To: <878s64e4ld.fsf@blind.guru> (Mario Lang's message of "Tue, 30 Mar 2021 23:03:58 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=rpluim@gmail.com; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:267212 Archived-At: >>>>> On Tue, 30 Mar 2021 23:03:58 +0200, Mario Lang sai= d: Mario> Robert Pluim writes: >>>>>>> On Tue, 30 Mar 2021 13:11:47 +0200, Mario Lang said: >>=20 Mario> Replying to self Mario> Nevermind, it works by creating a datagram server first, and the= n using Mario> set-process-datagram-address to set the destination. The server= process Mario> can now be used to send UDP as well. However, I am seeing lost = incoming Mario> packets. According to tcpdump, the reply is clearly there, but = the Mario> process filter only seems to pick it up 1 out of roughly 4 times. Mario> Weird. >>=20 >> Hmm, I have a patch somewhere to allow setting the sending port >> directly, I=CA=BCll see if I can find it and resurrect it. Mario> OK. However, we'd also need a way to get the listening port of a= server Mario> process with :service t. At least I haven't seen a way to query= the Mario> listening port yet. (aref (process-contact server :local) 4) >> Having said that, this sounds like it might be a bug (although I >> haven't checked if the emacs code supports sending from a datagram >> server like this). Mario> It does works, and also flawlessly. The weirdness I saw was due= to a Mario> coding-system issue, `osc-make-server` did not set :coding 'bina= ry, Mario> which is now fixed. >> Could you open a bug with M-x report-emacs-bug with your emacs >> version, and sample code? Mario> I'd rather not, since this behaviour is actually wanted. Mario> It is the only way I have to communicate with a certain external= program Mario> directly from elisp. scsynth always replies to the sender port.= .. No need, since it appears there=CA=BCs no bug :-) Mario> To reproduce, all you need is create a datagram server, and set = the Mario> datagram-address to the desired destination. You can now receive Mario> datagrams, and also use process-send-string to send to the desir= ed Mario> destination. Based on my (vague) recollection, for a server process you should be able to pass in :service anyway, so then there=CA=BCs no need to query for the port. Robert --=20