(ql:quickload "usocket") (defpackage #:net-construct (:use #:usocket #:CL)) (in-package #:net-construct) (defparameter *server* (socket-listen *wildcard-host* 23444 :element-type '(unsigned-byte 8))) (defun send-data () (let ((data (make-array 5 :element-type '(unsigned-byte 8) :initial-contents #(1 1 1 1 1))) (connection (socket-connect *wildcard-host* 23444 :protocol :datagram :element-type '(unsigned-byte 8)))) (socket-send connection data (length data)) (socket-close connection))) ;;;edit (defun receive-data () (let ((data) (connection (socket-connect *wildcard-host* 23443 :local-host *wildcard-host* :local-port 23454 :protocol :datagram :element-type '(unsigned-byte 8)))) (if (wait-for-input connection) (setf data (socket-receive connection nil 5))) (socket-close connection) data)) (defun send-data () (let ((data (make-array 5 :element-type '(unsigned-byte 8) :initial-contents #(1 1 1 1 1))) (connection (socket-connect *wildcard-host* 23455 :local-host *wildcard-host* :local-port 23443 :protocol :datagram :element-type '(unsigned-byte 8)))) (socket-send connection data (length data)) (socket-close connection)))