aboutsummaryrefslogtreecommitdiff
path: root/feasibility_analysis/tcpvanilla/client.rkt
diff options
context:
space:
mode:
authoriskm <iskm@users.noreply.github.com>2017-04-09 22:49:46 -0400
committerGitHub <noreply@github.com>2017-04-09 22:49:46 -0400
commit385c4f4664ae8157e62f118f15d4c670a4c1356b (patch)
treedcb37e29867a6294e8a321ea535e6e9ecd03c296 /feasibility_analysis/tcpvanilla/client.rkt
parent4890b61f08698a84e261f162dc2acd404bcc6b6b (diff)
parent44c715c55c239495da8f780276866c0041f04139 (diff)
Merge pull request #1 from oplS17projects/mango0.2
Mango
Diffstat (limited to 'feasibility_analysis/tcpvanilla/client.rkt')
-rw-r--r--feasibility_analysis/tcpvanilla/client.rkt72
1 files changed, 0 insertions, 72 deletions
diff --git a/feasibility_analysis/tcpvanilla/client.rkt b/feasibility_analysis/tcpvanilla/client.rkt
deleted file mode 100644
index 967d2b9..0000000
--- a/feasibility_analysis/tcpvanilla/client.rkt
+++ /dev/null
@@ -1,72 +0,0 @@
-#lang racket
-
-;; Both `server' and `accept-and-handle' change
-;; to use a custodian.
-;; To start server
-;; (define stop (client 8080))
-;; use your web browser to connect localhost:8080 greeted with "hello world"
-;; (stop) to close the server
-
-(define (client port-no)
- (define main-client-cust (make-custodian))
- (parameterize ([current-custodian main-client-cust])
- ;; connect to server at port 8080
- (define-values (in out) (tcp-connect "localhost" port-no)) ;; define values
- ;; binds to multiple values akin to unpacking tuples in python
- ; (thread (lambda ()
- (chat in out)
- (close-input-port in)
- (close-output-port out))
- (custodian-shutdown-all main-client-cust))
-
- ; (sleep 60) ;; run for 3 minutes then close
- ; (define (loop)
- ; (write (read-line (current-input-port)) out)
- ; (flush-output out)
- ; (write (read-line in) (current-output-port))
- ; (define listener (tcp-listen port-no 5 #t))
- ; (define (loop)
- ; (accept-and-handle listener)
- ; (loop))
- ; (thread loop)))
- ; (custodian-shutdown-all main-client-cust)
- #| (lambda () |#
- ; (displayln "Goodbye, shutting down client\n")
- #| (custodian-shutdown-all main-client-cust)) |#
-
-(define (chat in out)
- ; (driver-loop in out)
- (writeln "Ibrahim: Hello, anyone in chat?" out)
- (flush-output out) ;; ports are buffered in racket must flush or you
- ;; will read #eof
- (sleep 10) ;; wait 10 seconds
- (define serv-message (read-line in))
- (displayln serv-message) ;; read the servers replay message which is original
- ;; with echo appended to it
- )
-
-; (define input-prompt "Hermes: ")
-
-(define (driver-loop in out)
- ; (prompt-for-input input-prompt)
- (display ">>> ")
- (define input (read))
- (writeln (string-append "Ibrahim: " input) out)
- (flush-output out)
- ; (sleep 10)
- (define output (read-line in))
- (displayln output)
- (driver-loop in out))
-
-
-#| (let ((input (read))) |#
-; )
-; (let ((input (read)))
-; (let ((output (mc-eval input the-global-environment)))
-; (announce-output output-prompt)
-; (user-print output)))
-; (driver-loop))
-;
-; (define (announce-output string)
-; (display string))
-#| |#