File: udp-client.lsp

package info (click to toggle)
newlisp 10.7.5-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 6,248 kB
  • sloc: ansic: 33,280; lisp: 4,181; sh: 609; makefile: 215
file content (23 lines) | stat: -rw-r--r-- 550 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env newlisp

; Demo client for non-blocking UDP communications
;
; Start the server program udp-server.lsp first.
;
; Note, that net-listen in UDP mode only binds the socket
; to the local address, it does not 'listen' as in TCP/IP.
; v.1.0
; v.1.1 change net-receive for 10.0

(set 'socket (net-listen 10002 "" "udp"))
(if (not socket) (println (net-error)))
(while (not (net-error))
	(print "enter something -> ")
	(net-send-to  "127.0.0.1" 10001 (read-line) socket)
	(net-receive socket buff 255)
	(println "=> " buff))

(exit)

; eof