From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mario Lang Newsgroups: gmane.emacs.devel Subject: Re: UDP: Send and receive on same port? Date: Tue, 30 Mar 2021 23:03:58 +0200 Message-ID: <878s64e4ld.fsf@blind.guru> References: <87mtulxbko.fsf@blind.guru> <87a6qkew0c.fsf@blind.guru> <87pmzg4qd4.fsf@gmail.com> 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="10808"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Robert Pluim Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Mar 30 23:06:52 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 1lRLZb-0002iB-Cx for ged-emacs-devel@m.gmane-mx.org; Tue, 30 Mar 2021 23:06:51 +0200 Original-Received: from localhost ([::1]:34066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lRLZa-0001oT-CM for ged-emacs-devel@m.gmane-mx.org; Tue, 30 Mar 2021 17:06:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51398) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRLXj-0001As-Ti for emacs-devel@gnu.org; Tue, 30 Mar 2021 17:04:57 -0400 Original-Received: from familiekainz.at ([37.187.20.171]:44726 helo=ns3035380.ip-37-187-20.eu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRLXa-0004ue-Cm for emacs-devel@gnu.org; Tue, 30 Mar 2021 17:04:54 -0400 Original-Received: by ns3035380.ip-37-187-20.eu (Postfix, from userid 110) id 2CD02D0D; Tue, 30 Mar 2021 21:04:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=blind.guru; s=mail; t=1617138283; bh=Xxkq3ypGSVP1cH8FXU/PtbpCYfgICjHN1qCh4tWQ6Rg=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=rMBcRy6BzwdhyWiNhKl8tq9XlSJQlPRmoxxO+moaG4MzcLO1Q30AWvRL0uu6LJ6lM XU3z3PKzSOmtXJgXy9xFnJhU4GmbtAEa/LCaFos87IEbG8dtdSZuZM+xnhb8ykynJ7 TCaWexOiS8q3ZHKfKoCv2knHLrrCmsU0asSYUosM= Original-Received: from x1.blind.guru (84-115-55-45.cable.dynamic.surfer.at [84.115.55.45]) by ns3035380.ip-37-187-20.eu (Postfix) with ESMTPSA id 90442CCF; Tue, 30 Mar 2021 21:03:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=blind.guru; s=mail; t=1617138239; bh=Xxkq3ypGSVP1cH8FXU/PtbpCYfgICjHN1qCh4tWQ6Rg=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=SNbH5VD5fFzqxMaeR0QOj7Qg+OY6et84+5gOABpNYq5soEIDB2FyZQsRTzmgT6pqB TuMa2GeUlBsui1AIfY2FtyxHDLgdIKLcTbqODmn62oSpYzH9uCUoRE2+7VcuBrdrSd b58Z5PqnMdMi0pJi+XpNhiN6aHuKStxIA7na/v+k= Original-Received: by x1.blind.guru (Postfix, from userid 1000) id 8EB39E80506; Tue, 30 Mar 2021 23:03:58 +0200 (CEST) In-Reply-To: <87pmzg4qd4.fsf@gmail.com> (Robert Pluim's message of "Tue, 30 Mar 2021 17:23:51 +0200") Received-SPF: pass client-ip=37.187.20.171; envelope-from=mlang@blind.guru; helo=ns3035380.ip-37-187-20.eu 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, 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:267196 Archived-At: Robert Pluim writes: >>>>>> On Tue, 30 Mar 2021 13:11:47 +0200, Mario Lang sa= id: > > Mario> Replying to self > Mario> Nevermind, it works by creating a datagram server first, and t= hen using > Mario> set-process-datagram-address to set the destination. The serv= er process > Mario> can now be used to send UDP as well. However, I am seeing los= t incoming > Mario> packets. According to tcpdump, the reply is clearly there, bu= t the > Mario> process filter only seems to pick it up 1 out of roughly 4 tim= es. > Mario> Weird. > > 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. OK. However, we'd also need a way to get the listening port of a server process with :service t. At least I haven't seen a way to query the listening port yet. > 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). It does works, and also flawlessly. The weirdness I saw was due to a coding-system issue, `osc-make-server` did not set :coding 'binary, which is now fixed. > Could you open a bug with M-x report-emacs-bug with your emacs > version, and sample code? I'd rather not, since this behaviour is actually wanted. It is the only way I have to communicate with a certain external program directly from elisp. scsynth always replies to the sender port... To reproduce, all you need is create a datagram server, and set the datagram-address to the desired destination. You can now receive datagrams, and also use process-send-string to send to the desired destination. --=20 CYa, =E2=A1=8D=E2=A0=81=E2=A0=97=E2=A0=8A=E2=A0=95