01 ;;; -*- Lisp -*- mode
02
03 (in-package #:com.paskvil.uhttp)
04
05 (defun client-connect (addr &optional (port 80))
06 "Connects to the socket run by the server at ADDR:PORT.
07 Returns a stream for use with CLIENT-READ, CLIENT-SEND, and CLIENT-CLOSE."
08 (usocket:socket-connect addr port))
09
10 (defun client-close (stream)
11 "Closes the client socket STREAM returned by CLIENT-CONNECT, and the connection."
12 (usocket:socket-close stream))
13
14 (defun client-read (stream)
15 "Reads from a socket STREAM returned by CLIENT-CONNECT."
16 (read (usocket:socket-stream stream)))
17
18 (defun client-send (string stream)
19 "Write a STRING to socket STREAM returned by CLIENT-CONNECT."
20 (print string (usocket:socket-stream stream))
21 (force-output (usocket:socket-stream stream)))
22
© 2011 Josef Nygrin - paskvil.com