[usocket-devel] Extending USOCKET to support UDP (cmucl, sbcl, openmcl and lispworks is done)
Chun Tian (binghe)
binghe.lisp at gmail.com
Wed Mar 19 11:57:47 UTC 2008
Hi, USOCKET project
Since your WAIT-FOR-INPUT is so good and portable, I'm extending you
to support UDP which used in my project.
I still much like a STREAM interface as the MESSAGE interface, so I
implemented them BOTH.
For "STREAM" interface, I made a SOCKET-CONNECT/UDP function:
socket-connect/udp (host port &key (stream nil) (element-type
'(unsigned-byte 8)))
If one of host and port is NIL, it'll return a normal, unconnected UDP
usocket, or it'll return a "connected" UDP socket, and if the STREAM
key also is T, it'll return a STREAM which can be used like a TCP
stream.
The "MESSAGE" interface for UDP usocket is this two functions:
socket-send ((socket datagram-usocket) buffer length &key address port)
socket-receive ((socket datagram-usocket) buffer length)
Their API is quite like those in SBCL.
At present, SBCL, CMUCL, OpenMCL and LispWorks' "STREAM" interface is
done and tested. The MESSAGE interface haven't been tested.
All my work can be found here: (in a SVN repository)
https://cl-net-snmp.svn.sourceforge.net/svnroot/cl-net-snmp/snmp/trunk/usocket-udp
To support UDP server, I think a "iterate" UDP server support is much
straightforward to write: Make a portable thread (use the bordeaux-
threads project) and just receive and send message using the MESSAGE
interface. Since I also have a SNMP server in my project, I planed to
write this UDP server in my USOCKET-UDP directory.
If the maintainer want to merge my code, just do it, or I'll keep them
myself.
Regards,
Chun Tian (binghe)
More information about the usocket-devel
mailing list