aboutsummaryrefslogtreecommitdiff
path: root/feasibility_analysis/tcpvanilla/tcptalk.rkt
diff options
context:
space:
mode:
authorIbrahim Mkusa <ibrahimmkusa@gmail.com>2017-04-09 22:37:50 -0400
committerIbrahim Mkusa <ibrahimmkusa@gmail.com>2017-04-09 22:37:50 -0400
commitcb381871d518077649be6272af823dabec2fcd28 (patch)
tree98547efe9389421f9f58219a8278e166d2b069c6 /feasibility_analysis/tcpvanilla/tcptalk.rkt
parent404f3d7edfe648dc3fd51c1afc1b3984557f1902 (diff)
reorganized repo a bit better
Diffstat (limited to 'feasibility_analysis/tcpvanilla/tcptalk.rkt')
-rw-r--r--feasibility_analysis/tcpvanilla/tcptalk.rkt30
1 files changed, 0 insertions, 30 deletions
diff --git a/feasibility_analysis/tcpvanilla/tcptalk.rkt b/feasibility_analysis/tcpvanilla/tcptalk.rkt
deleted file mode 100644
index d069851..0000000
--- a/feasibility_analysis/tcpvanilla/tcptalk.rkt
+++ /dev/null
@@ -1,30 +0,0 @@
-#lang racket
-
-(define listener (tcp-listen 8083 5 #t)) ;; listener to service connection requests
-;; client attempts to connect. Receives an input and output port
-(define-values (client-in client-out) (tcp-connect "localhost" 8083))
-;; server accepts the connection request. Also gets a pair of ports
-(define-values (server-in server-out) (tcp-accept listener))
-
-;; client sends identifying message
-(display (string-append "Client:My name is " "Ibrahim" "\n")
- client-out)
-(flush-output client-out) ;; must flush as ports are buffered in racket
-
-;; server receives and reads it
-;; cooler if on separate racket instances
-(read-line server-in) ;; --> "Client:My name is #hostname.
-;; server replies
-(display (string-append "Server:Hi " "Ibrahim" "\n") server-out)
-(flush-output server-out) ;; flush flush
-
-;; client displays server message
-(read-line client-in)
-(close-output-port server-out)
-(close-output-port client-out)
-(read-line client-in) ;; --> eof object #eof
-(read-line server-in) ;; --> eof object #eof
-(tcp-close listener)
-; (custodian-shutdown-all (current-custodian)) ;; release all resources including
- ;; tcp, file, custom ports
- ;; application exits