2010/1/13 Chun Tian (binghe) <span dir="ltr"><<a href="mailto:binghe.lisp@gmail.com">binghe.lisp@gmail.com</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi, Elliott<br>
<br>
ÔÚ 2010-1-14£¬10:02£¬ Elliott Slaughter дµÀ£º<div class="im">
><br>
> [SOCKET-SEND]<br>
><br>
> Syntax: SOCKET-SEND usocket buffer length &key host port<br>
><br>
> SOCKET-SEND is used for sending packets through a UDP usocket, the "buffer" arguments usually need to be a vector of (unsigned-byte 8).<br>
><br>
> What does the return value of socket-send mean?<br>
<br>
</div>The return value of SOCKET-SEND is a integer which indicated how many bytes you actually send. In theory it should equal to the LENGTH argument in SOCKET-SEND, unless you're sending too much data. Currently the return value when sending fails is not defined clearly, for some CLs "-1" will mean "sending fail", but I think I should change it to "NIL" instead in the future.<br>
</blockquote><div><br></div><div>I would probably expect usocket to throw an error if the packet failed to be sent. I would prefer that to having a special return value for failure.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
The constant +max-datagram-packet-size+ is defined in usocket.lisp, line 14:<br>
<br>
(defconstant +max-datagram-packet-size+ 65536)<br>
<br>
I didn't export the symbol +MAX-DATAGRAM-PACKET-SIZE+ because it's a constant and hard limit of UDP implementation. Users don't need to change it's value, instead, there're extra keyword arguments in API functions when user want to set maximum packet sizes.<font class="Apple-style-span" color="#888888"><br>
</font></blockquote></div><div><br></div>I'm not trying to imply that users would want to change this value, since it is a system constant, but that users might want to use it as a parameter to length in socket-receive as usocket throws an error if both buffer and length are nil. Or you might just want this to be the default (when they are both nil).<div>
<br></div><div>Thanks for answering my questions.</div><div><br>-- <br>Elliott Slaughter<br><br>"Don't worry about what anybody else is going to do. The best way to predict the future is to invent it." - Alan Kay<br>
</div>