[clfswm-cvs] r440 - clfswm/contrib/server
Philippe Brochard
pbrochard at common-lisp.net
Tue Apr 12 21:20:11 UTC 2011
Author: pbrochard
Date: Tue Apr 12 17:20:11 2011
New Revision: 440
Log:
contrib/server.lisp: Use the same port variable in the server and the client
Modified:
clfswm/contrib/server/clfswm-client.lisp
clfswm/contrib/server/server.lisp
Modified: clfswm/contrib/server/clfswm-client.lisp
==============================================================================
--- clfswm/contrib/server/clfswm-client.lisp (original)
+++ clfswm/contrib/server/clfswm-client.lisp Tue Apr 12 17:20:11 2011
@@ -50,7 +50,7 @@
#+ccl (ccl:quit))
-(defparameter *server-port* 33333)
+;;(defparameter *server-port* 33333)
(defun print-output (sock &optional wait)
(when (or wait (ignore-errors (listen sock)))
@@ -83,7 +83,7 @@
(parse-args sock (subseq args pos))))))
-(defun start-client (args &optional (url "127.0.0.1") (port *server-port*))
+(defun start-client (args &optional (url "127.0.0.1") (port clfswm::*server-port*))
(load-new-key)
(let* ((sock (port:open-socket url port))
(key (string-trim '(#\Newline #\Space) (decrypt (read-line sock nil nil) *key*))))
Modified: clfswm/contrib/server/server.lisp
==============================================================================
--- clfswm/contrib/server/server.lisp (original)
+++ clfswm/contrib/server/server.lisp Tue Apr 12 17:20:11 2011
@@ -32,6 +32,9 @@
;;; Server <-> Client: All connections are crypted with new_key
;;; --------------------------------------------------------------------------
+(in-package :clfswm)
+
+(defparameter *server-port* 33333)
(format t "Loading the clfswm server code... ")
@@ -46,9 +49,8 @@
(use-package :crypt)
(defstruct server-socket stream auth form key)
-
(defparameter *server-socket* nil)
-(defparameter *server-port* 33333)
+
(defparameter *server-allowed-host* '("127.0.0.1"))
(defparameter *server-wait-timeout* 0.001d0)
@@ -59,6 +61,12 @@
+(defun server-show-prompt (sock)
+ ;;(send-to-client sock nil (format nil "~A> " (package-name *package*))))
+ (format (server-socket-stream sock) "~A~%"
+ (crypt (format nil"~A> " (package-name *package*)) (server-socket-key sock)))
+ (force-output (server-socket-stream sock)))
+
(defun send-to-client (sock show-prompt-p &rest msg)
(dolist (m (if (consp (car msg)) (car msg) msg))
@@ -67,9 +75,9 @@
(when show-prompt-p
(server-show-prompt sock)))
+;;(defun server-show-prompt (sock)
+;; (send-to-client sock nil (format nil "~A> " (package-name *package*))))
-(defun server-show-prompt (sock)
- (send-to-client sock nil (format nil "~A> " (package-name *package*))))
(defun read-from-client (sock)
More information about the clfswm-cvs
mailing list