Hi, I am a newbi for Lisp programming. But i got finish of this project which i am doing. I need your help please.
I have server which is written on LISP. The server itself works fine. The problem which I have is if my client sends a string data to the server. The server can read just one char. That is when i use read or read-line functions. There is no effect at all on passive sockets. Here is a snap of my code which I am facing problem with:
Code:
(defun RouteServer (&key (port 9259))
(let ((p (socket:make-socket :connect :passive
:local-port port
:reuse-address t)))
;; Accept the connections here
(loop
(let ((s (socket:accept-connection p)))
;; Read the char from the client
(setf R (read-char s))
;; If i use read here it donst even read anything from the stream.
;;(setq R (read s))
;; Switch statment to check, which function need
;; to be executed.
;; 1 - Robert problem
;; 2 - MAZE problem
;; 3 - Stops the server (But the port is not closed yet)
(cond ((eq R #\1) (format s "~s|" (callops))
(format s "Error: Invalid function call"))
((eq R #\2) (format s "~s|" (callMAZE))
(format s "Error: Invalid function call"))
((eq R #\3) #'(lambda () (close s)(close p))(return)))
(close s)))))
Thanks a lot
ssharish