Ticket #680 (closed defect: fixed)

Opened 5 years ago

Last modified 4 years ago

ccl:send-to says it can take a string arg, but it really can't.

Reported by: rme Owned by:
Priority: minor Milestone:
Component: other Version: trunk
Keywords: Cc:

Description

Welcome to Clozure Common Lisp Version 1.6-dev-r13678M  (DarwinX8664)!
? (defparameter *s* (make-socket :type :datagram))
*S*
?  (send-to *s* "hey" 3 :remote-host "127.0.0.1" :remote-port 12345)
> Error: value "hey" is not of the expected type (OR (ARRAY CHARACTER)
>                                                    (ARRAY (UNSIGNED-BYTE 8))
>                                                    (ARRAY (SIGNED-BYTE 8))).
> While executing: VERIFY-SOCKET-BUFFER, in process listener(1).
> Type :POP to abort, :R for a list of available restarts.
> Type :? for other options.
1 > 

verify-socket-buffer is actually checking for an 8-bit subtag, and with this new-fangled unicode thing, that doesn't include strings.

My first inclination is to say that i/o on datagram sockets is done in octects. This requires the user to use encode-string-to-octects/decode-string-from-octets explicitly.

It might also be work to pay attention to the socket object's external format and encode the string on the user's behalf, but if Gilgamesh wants to send a cuneiform string "foo", then the actual buffer length in octets isn't going to be 3.

Change History

comment:1 Changed 4 years ago by rme

  • Status changed from new to closed
  • Resolution set to fixed

r13773 and r13774 make it explicit that the vectors passed to receive-from/send-to must be octet vectors, and that a udp socket's socket-format is always :binary.

Note: See TracTickets for help on using tickets.