ruseng@iesd.auc.dk (Carsten Ruseng Jakobsen) (02/23/90)
I have a written a Hyper-text back-end server (HyperBase) which is
communicating via sockets. I am now writing an interface in emacs to
this server. I have succeded in sending simple argument's as 4 byte
integers from the server to emacs and converting them, and vice versa.
However when I'm trying to read a larger amount of data, the result
is that (accept-process-output) blocks. Instead of relying on this
function I would like to read ONE character from the process attached
to the socket. Does such function exist, or how can I read one character
at a time from the process-output (the stuff the server is writing
to the socket.)
If you have the answer please *e-mail* it to ruseng@iesd.auc.dk
The scenario look's like:
(setq read-proc(open-network-stream
"read-sock" "READ-buffer" hostname read-port))
(set-process-filter read-proc 'read-filter)
. . .
(defun hb-read ()
"Read the DATA-field from mode ent_no and insert it to current buffer"
(interactive)
(progn
(setq ent_no (read-input "Entity-no : "))
(process-send-string write-proc "\000\000\000\001") ;1 = READ
(process-send-string write-proc
(int-to-string-4ch (string-to-int ent_no)))
(process-send-string
write-proc (int-to-string-4ch 517)) ; 517= Read the DATA-field
(set-process-filter read-proc 'read-filter)
(accept-process-output read-proc) ;BLOCKING (when filter <> nil)
)
; If the return value is zero then get the stuff, otherwise exit nil.
(cond ((= 0 ret)(progn
; read length of the data to be read
(set-process-filter read-proc 'receive-number)
(accept-process-output read-proc)
; read the data
; (set-process-filter read-proc 'receive-string)
(accept-process-output read-proc)
(insert-string string-received); insert in current buffer
))
)
)
Thanx in advance
------------------------------------------------------------------------------
| Carsten Ruseng Jakobsen,ruseng@iesd.auc.dk {...}!mcvax!dkuug!iesd!ruseng|
| Systems programmer |
| _ / |
| Department of Mathematics and Computer Science - / ( |
| Aalborg University (AUC) / | \ |
| DENMARK A U C |
------------------------------------------------------------------------------