Hey guys, its me again. I tried playing around with this for the last
couple of weeks but am still stuck on it and was wondering if I could
get more help. This is what i have but it looks like the stream is not
of the right type? Once again, I am trying to send a string over a tcp
socket. My lisp has been improving but I am really stuck on this. Any
help would be appreciated.
;;set my stream to nil
(defvar *stream* nil)
(defvar *socket* nil)
(defvar *port* nil)
;;helper function to resolve host name
(defun resolve-hostname (name)
((eql name :any) #(0 0 0 0))
((typep name '(vector * 4)) name)
(t (car (sb-bsd-sockets:host-ent-addresses
;;this sets up a socket on the port
(defun setup-sockets (port)
(setf *port* port)
(setf *socket* (make-instance 'sb-bsd-sockets:inet-socket :type
:stream :protocol :tcp))
(sb-bsd-sockets:socket-bind *socket* (resolve-hostname "localhost") port)
;;builds a stream on the socket
(setf *stream* (sb-bsd-sockets:socket-make-stream *socket* :input t
:buffering :full :element-type 'character))
(defun tcp-wrapper (fn)
(write-sequence (eval fn) *stream*)
Johan Ur Riise wrote:
> On Thu, 2007-04-12 at 15:46 -0400, jjmccaw@... wrote:
>> Hello everyone. I am trying to send information over a TCP connection. I have the socket and stream setup but am having difficulties sending data over it. Upon researching, i found the Sb-bsd-sockets:socket-send would suit my needs. I then discovered that this became available in .9.12 and since i am running a Sparc machine with solaris, i am limited to only .9.11. So, i downloaded the sbcl .9.14 source code and attempted to compile it's sb-bsd-socket:socket-send function. I copied that into a file and made it a normal function instead of being part of the library (made it a defun). I then copied over many other functions that are called by it directly or indirectly. When i go to run the function though, i am told that (sockint::sendto()) is an undefined function. I attempted to require that library but that did not find anything. so my questions are as follows:
>> 1. Is there another way to send data over the stream that does not use sb-bsd-sockets:socket-send (i assume there has to be)
>> 2. Does sockint::sendto belong to a library and if so, what is it?
> I think the normal way to use a socket in tcp-mode is to get the stream
> with (sb-bsd-sockets:socket-make-stream ...), then to use the normal
> stream functions like read-char, write-sequence etc.
> socket-send is good if you use udp, although from the documentation it
> can also be used for tcp (I never tried that).
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> Sbcl-help mailing list