From 11bcec105200eef5da68bce4f1952338d204d8c1 Mon Sep 17 00:00:00 2001 From: Ibrahim Mkusa Date: Sat, 15 Apr 2017 20:32:26 -0400 Subject: [PATCH] preliminary work on adding sessions stickiness --- Hermes/TODO | 5 +++-- Hermes/client.rkt | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Hermes/TODO b/Hermes/TODO index 7b2c43f..f5f0a1c 100644 --- a/Hermes/TODO +++ b/Hermes/TODO @@ -1,6 +1,5 @@ FEATURES 1. Create a racket module for commonly used functions -2. Log error messages and channel conservations to proper files on server 4. message parsable? 5. command parsable? 7. maybe fiddle around with irc library @@ -10,7 +9,9 @@ FEATURES e 12. Hide user's own input in command line 14. bye message prompt for clients -15. Session stickiness for clients +*15. Session stickiness for clients. Log received comms to a local file. +additionally save user details and prompt user to use defaults or create +new ones 16. plain tcp -> ssl based 17. fix breaks for improper disconnects from clients 18. Add topics after project completion diff --git a/Hermes/client.rkt b/Hermes/client.rkt index 745cf84..5e99a96 100644 --- a/Hermes/client.rkt +++ b/Hermes/client.rkt @@ -1,14 +1,26 @@ #lang racket (require math/base) ;; for random number generation ;; TODO clean up string message output and alignment +;; i.e. seconds and minutes hours specifically ;; author: Ibrahim Mkusa ;; about: print and read concurrently ;; notes: output may need to be aligned and formatted nicely + + + (define host "10.0.0.160") ; internal home (define host2 "67.186.191.81") (define host3 "localhost") (define port-num 4321) +(define hermes-conf (open-output-file "./hermes.conf" 'append)) +(define hermes-conf-s (make-semaphore 1)) + +(define convs-out (open-output-file "./convs.out" 'append)) +(define convs-out-s (make-semaphore 1)) + +(define error-out (open-output-file "./error.out" 'append)) +(define error-out-s (make-semaphore 1)) ; custodian for client connections (define main-client-cust (make-custodian)) @@ -17,9 +29,10 @@ (parameterize ([current-custodian main-client-cust]) ;; connect to server at port 8080 (define-values (in out) (tcp-connect host3 port-no)) ;; define values - (display in) - (displayln out) ;; binds to multiple values akin to unpacking tuples in python + + ; store username to a file for later retrieval along with relevent + ; info used for authentication with server (displayln "What's your name?") (define username (read-line))