32 lines
601 B
Racket
32 lines
601 B
Racket
#lang racket
|
|
|
|
; You can use this skeleton to connect to the server
|
|
; but feel free to use any programming language to your
|
|
; liking
|
|
|
|
|
|
; connect to the server
|
|
(define-values (in out) (tcp-connect "51.15.125.82" 9004))
|
|
(file-stream-buffer-mode in 'none)
|
|
(file-stream-buffer-mode out 'none)
|
|
|
|
; Some commands you can use
|
|
|
|
; Read a line
|
|
(read-line in)
|
|
|
|
; Read a single character
|
|
(read-char in)
|
|
|
|
; Read 5 characters
|
|
(read-string 5 in)
|
|
|
|
; Write a string to the server
|
|
(write-char #\a out)
|
|
|
|
; Write a string to the server
|
|
(write-string "AMC to the moon" out)
|
|
|
|
; Write a newline to the server
|
|
(newline out)
|