[usocket-devel] Re: UDP support in usocket, ideas explained

Chun Tian (binghe) binghe.lisp at gmail.com
Sat Mar 8 16:43:10 UTC 2008


Hi, Erik

I attached a patch, which implemented SOCKET-SEND and SOCKET-RECEIVE for
LispWorks. I use recvfrom() and sendto() to do this.

But what I don't know is the API of UDP socket creation: I must make a
socket fd first, then send/reveive messages. Could you give me some  
advice?

Regards,
Chun Tian (binghe)

> When looking at usocket.lisp, you'll find there is a datagram-usocket
> class commented out. I think this class (even without any additional
> slot definitions) should be used for UDP sockets.
>
> Then there's datagram-usocket-p, which should start returning T when
> the passed in object is a true descendant of DATAGRAM-USOCKET.
>
> Looking further, you'll find there are functions defined for creating
> stream and stream-server objects. A function like that should be
> created for UDP sockets.
>
> I think it's only sane to extend WAIT-FOR-INPUT to apply to UDP
> sockets as well as any of the currently supported sockets. The
> LispWorks variant of this function (for win32) is still on my laptop.
> I'll try to finish it up soon, so that you can all start testing it.
>
>
> I propose we implement recv()/recvfrom() as one function:
> SOCKET-RECEIVE. I think we shouldn't bother implementing recv() and
> recvfrom() as separate interfaces: I think we should return the
> recvfrom-address field as the second return value of SOCKET-RECEIVE.
>
> I also propose we implement send()/sendto() as one function:
> SOCKET-SEND. I think we should provide the sendto address as an
> optional parameter to the SOCKET-SEND function.
>
> Also, I think the function should check for connected-ness of the
> datagram socket. If the sendto address is specified on a connected
> socket AND the address specified is unequal to the connected address,
> the function should error.
>
> Oh. One last thing: local and peer address retrieval functions should
> be adapted to apply to UDP sockets as well as the currently supported
> stream sockets.
>
> I hope this is all a bit clear! If you have (m)any questions, please
> don't hesitate to ask.
>
> Bye,
>
>
> Erik.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: lispworks.patch
Type: application/octet-stream
Size: 6166 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/usocket-devel/attachments/20080309/ed816d25/attachment.obj>
-------------- next part --------------



More information about the usocket-devel mailing list