aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIbrahim Mkusa <ibrahimmkusa@gmail.com>2017-04-12 12:33:13 -0400
committerIbrahim Mkusa <ibrahimmkusa@gmail.com>2017-04-12 12:33:13 -0400
commit8984b45ac129ac35c4b05e00d7fbbd89cb086e58 (patch)
treed32771d17422dcabe0671a5c863ff3d0430259a2
parent282197b1448dc34b2e26c352e6ebd0150c1f5199 (diff)
Added a tracker for todo items and started added utility functions
-rw-r--r--Hermes/TODO.txt7
-rw-r--r--Hermes/client.rkt22
2 files changed, 13 insertions, 16 deletions
diff --git a/Hermes/TODO.txt b/Hermes/TODO.txt
new file mode 100644
index 0000000..9f9ae33
--- /dev/null
+++ b/Hermes/TODO.txt
@@ -0,0 +1,7 @@
+1. Create a racket module for commonly used functions
+2. Log messages to proper file on server
+3. add timestamps to clients messages
+4. message parsable?
+5. command parsable?
+6. keep count of connected clients using object orientation
+7.
diff --git a/Hermes/client.rkt b/Hermes/client.rkt
index 329ea5d..894c178 100644
--- a/Hermes/client.rkt
+++ b/Hermes/client.rkt
@@ -1,28 +1,18 @@
#lang racket
(require math/base) ;; for random number generation
;; TODO clean up string message output and alignment
-
;; author: Ibrahim Mkusa
;; about: print and read concurrently
;; notes: output may need to be aligned and formatted nicely
;; look into
;; https://docs.racket-lang.org/gui/text-field_.html#%28meth._%28%28%28lib._mred%2Fmain..rkt%29._text-field~25%29._get-editor%29%29
-;; create custodian for managing all resources
-;; so we can shutdown everything at once
-;(define guard (make-custodian (current-custodian)))
-;(current-custodian guard)
-;; reads values continously from stdin and redisplays them
-
-;; Notes connect to server on localhost
-;; use client template of tcpvanilla
-;; use event for read-write
-
-;; modify read-loop-i
-; read a value and send it to server via output-port
-
-; is there something in the input port. If yes? display it
-; in the hello world
+; Takes a string and a semaphore to print safely to stdout
+(define displayln-safe
+ (lambda (a-string a-semaphore)
+ (semaphore-wait a-semaphore)
+ (displayln a-string)
+ (semaphore-post a-semaphore)))
; custodian for client connections
(define main-client-cust (make-custodian))