unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* UDP Socket
       [not found] <1141056974.1414056.1453896763791.JavaMail.yahoo.ref@mail.yahoo.com>
@ 2016-01-27 12:12 ` Tobias Reithmaier
  2016-01-27 12:22   ` tomas
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Reithmaier @ 2016-01-27 12:12 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

Hello,
I have a question about emacs-lisp programming.There is a lack of documentation for socket programming.
I want to create an echo-Application.For Example:

(make-network-process :name "udp-socket1" :remote '[127 0 0 1 1500] :type 'datagram :filter 'print-it)(process-send-string "udp-socket1" "hello").
...now hopefully this sends an udp-datagram...How can i receive one?
I guess, because where is no receive-function, this network-process receives datagrams automatically.But how can i send datagrams to over an udp-connection to this process.Not (process-send), but over udp with another elisp-program?

regards
Tobias



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: UDP Socket
  2016-01-27 12:12 ` UDP Socket Tobias Reithmaier
@ 2016-01-27 12:22   ` tomas
  0 siblings, 0 replies; 2+ messages in thread
From: tomas @ 2016-01-27 12:22 UTC (permalink / raw)
  To: help-gnu-emacs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, Jan 27, 2016 at 12:12:43PM +0000, Tobias Reithmaier wrote:
> Hello,
> I have a question about emacs-lisp programming.There is a lack of documentation for socket programming.
> I want to create an echo-Application.For Example:
> 
> (make-network-process :name "udp-socket1" :remote '[127 0 0 1 1500]
     :type 'datagram :filter 'print-it)(process-send-string "udp-socket1" "hello").
> ...now hopefully this sends an udp-datagram...How can i receive one?
> I guess, because where is no receive-function, this network-process receives
> datagrams automatically.But how can i send datagrams to over an udp-connection
> to this process.Not (process-send), but over udp with another elisp-program?

Here's something to get you started. Season to taste :-)

  (setq netty (make-network-process
               :name "netty"
               :type 'datagram
               :server t
               :family 'ipv4
               :service 1331
               :filter (lambda (proc string)
                         (message "proc <%S> said '%s'" proc string))))

If you want to talk to it, go to some terminal and say:

  echo "ding ding" | nc -u localhost 1331

All of that and more is in the Emacs Lisp reference, under 36 "Processes",
especially 36.14 "Network" to 36.17 "Low Level Network". Also of interest
(for the filter function) is 36.9 "Output from Processes".

Enjoy
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlaotqAACgkQBcgs9XrR2kZuHQCaA+PxeY9lZOsS2J8Ai9WZeIuS
8U0AmwbI2N3jX+2sQgcAu9WLRr7HYqHv
=D7P7
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-27 12:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1141056974.1414056.1453896763791.JavaMail.yahoo.ref@mail.yahoo.com>
2016-01-27 12:12 ` UDP Socket Tobias Reithmaier
2016-01-27 12:22   ` tomas

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).