This preview shows page 1. Sign up to view the full content.
Unformatted text preview: 'message-ignored) )) ;; This is the core of im-bots.scm. ;; It changes the socket's input callback to work with the bot. ;; If you understand this and the original SETUP-REQUEST-HANDLER, ;; you probably get client-server programming. (define (setup-bot port-from-server bot) ;;;Handle messages from the server by turning them into OO messages. (define (request-handler) (let ((req (get-request port-from-server))) (if (not req) (close-connection) (begin (format logging "Received request: ~S~%" req) ; This is the really important line! (ask bot (request-action req) (request-src req) (request-data req)) (if (and (not (port-closed? port-from-server)) (char-ready? port-from-server)) (request-handler)))))) (when-port-readable port-from-server request-handler))...
View Full Document
This note was uploaded on 11/30/2010 for the course EECS 21281 taught by Professor Harvey during the Spring '10 term at University of California, Berkeley.
- Spring '10