unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Mario Lang <mlang@blind.guru>
To: Robert Pluim <rpluim@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: UDP: Send and receive on same port?
Date: Tue, 30 Mar 2021 23:03:58 +0200	[thread overview]
Message-ID: <878s64e4ld.fsf@blind.guru> (raw)
In-Reply-To: <87pmzg4qd4.fsf@gmail.com> (Robert Pluim's message of "Tue, 30 Mar 2021 17:23:51 +0200")

Robert Pluim <rpluim@gmail.com> writes:

>>>>>> On Tue, 30 Mar 2021 13:11:47 +0200, Mario Lang <mlang@blind.guru> said:
>
>     Mario> Replying to self
>     Mario> Nevermind, it works by creating a datagram server first, and then 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.
>
> Hmm, I have a patch somewhere to allow setting the sending port
> directly, Iʼll 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.

-- 
CYa,
  ⡍⠁⠗⠊⠕



  reply	other threads:[~2021-03-30 21:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30  8:58 UDP: Send and receive on same port? Mario Lang
2021-03-30 11:11 ` Mario Lang
2021-03-30 15:23   ` Robert Pluim
2021-03-30 21:03     ` Mario Lang [this message]
2021-03-31  9:14       ` Robert Pluim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878s64e4ld.fsf@blind.guru \
    --to=mlang@blind.guru \
    --cc=emacs-devel@gnu.org \
    --cc=rpluim@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).