(define port 9000)
(define (main)
(let ((sd '?)
(line "")
(ret ""))
(set! sd (tcp-connect "127.0.0.1" port ))
(if (not (null? sd))
(begin
(while (string=? line "")
(set! line (read-line)))
(display "-->")
(set! line (read-line ))
(display "line before while: ")
(display line)
(newline)
(while (not (eof-object? line))
(set! ret (tcp-writen sd line (string-length line)))
(set! line (tcp-readline sd))
(display "response: ")
(display line)
(newline)
(display "-->")
(set! line (read-line )))
(tcp-close sd)
(display "client: connection closed!")
(newline))
(begin
(display "connect request rejected!")
(newline)))))
|