Hi Douglas,
I recently added some functionality in usocket and even though I
think I could have copy-pasted from the CMU backend, I want to verify
with you if this is true.
The functions I added:
- get-host-name (as you can see in the commit mail below based on
copy-paste from CMU)
- wait-for-input-internal which I didn't copy-paste yet.
I would be especially gratefull if you could copy-paste and verify the
latter for me and optionally even supply a patch.
For testing of the multiplexing code, I use this 'script':
(load "asdf.lisp")
(asdf:oos 'asdf:load-op :usocket)
(defvar sockets nil)
(defparameter crlf (format nil "~C~C" #\Return #\Linefeed))
(defparameter host "mirror.w3media.nl")
(defparameter offset-path "/apache")
(dotimes (i 10)
(let ((s (usocket:socket-connect host 80)))
(format (usocket:socket-stream s)
"GET http://~A~A/httpd/httpd-2.0.~A.tar.gz HTTP/1.0~%~%"
host offset-path (+ 50 i))
(force-output (usocket:socket-stream s))
(push s sockets)))
(let ((buffer (make-array 8192 :element-type 'character)))
(loop
(let ((ready (usocket:wait-for-input sockets :timeout 15)))
(unless ready
(sleep 1)
(format t "No ready sockets!~%"))
(dolist (r ready)
(format t "Reading from ~A~%" r)
(read-sequence buffer (usocket:socket-stream r))))))
HTH and thanks for your reaction in advance!
bye,
Erik.
---------- Forwarded message ----------
From: ehuelsmann(a)common-lisp.net <ehuelsmann(a)common-lisp.net>
Date: May 18, 2007 12:03 AM
Subject: [usocket-cvs] r245 - usocket/trunk/backend
To: usocket-cvs(a)common-lisp.net
Author: ehuelsmann
Date: Thu May 17 18:03:55 2007
New Revision: 245
Modified:
usocket/trunk/backend/scl.lisp
Log:
Add cl-smtp 'requirement': get-host-name (SCL backend); needs verification.
Modified: usocket/trunk/backend/scl.lisp
==============================================================================
--- usocket/trunk/backend/scl.lisp (original)
+++ usocket/trunk/backend/scl.lisp Thu May 17 18:03:55 2007
@@ -129,3 +129,6 @@
(t
(error 'ns-unknown-error :host-or-ip name
:real-error errno))))))))
+
+(defun get-host-name ()
+ (unix:unix-gethostname))
_______________________________________________
usocket-cvs mailing list
usocket-cvs(a)common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/usocket-cvs
All,
I received an error when trying to call `get-peer-name' on a connected
socket (`dotted-quad-to-vector-quad' was trying to parse a hostname as an
IP). The problem is that `get-peer-name' expects CLISP's
`socket:socket-stream-peer' function to always return a dotted-quad; by
default, however, `socket:socket-stream-peer' will attempt hostname
resolution on the peer address
(http://clisp.cons.org/impnotes/socket.html#sost-peer).
Fortunately, the second argument (`do-not-resolve-p') is used to suppress
this lookup, so the fix should be as simple as changing the `nil' below to
`t':
(defmethod get-peer-name ((usocket stream-usocket))
(multiple-value-bind
(address port)
(socket:socket-stream-peer (socket usocket) nil)
(values (dotted-quad-to-vector-quad address) port)))
I didn't try it out, but `get-local-name' looks to suffer from the same
issue:
(defmethod get-local-name ((usocket usocket))
(multiple-value-bind
(address port)
(socket:socket-stream-local (socket usocket) nil)
(values (dotted-quad-to-vector-quad address) port)))
Although I noticed the error using Windows XP at work, it looks to affect
CLISP in general.
-- Chandler
Today I have released usocket version 0.3.5 which contains fixes for:
- All backends: Implementation-dependent errors leaking through
- CLISP: compile-warnings fixed / get-local-name+get-peer-name
- ECL: memory leak in get-host-name / win32 compatibility fix
If you have any problems while using usocket, please report them on
his list, or, contact me (ehu) on #lisp in IRC at irc.freenode.net.
bye,
Erik Huelsmann.
1. 51 -> 53: need to revert this
2. 54 -> 56: function `strndup` is not defined on win32
and in body of function get-host-name (sbcl.lisp) prefix `sb-alien:`
need in any function `cast` call
Thanks!
--
WBR, Yaroslav Kavenchuk.