Skip to content

Commit 0e7ec0a

Browse files
committed
Core functionality achieved for TCP
1 parent 0baea52 commit 0e7ec0a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

RCat.rkt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
(set! machine-list (cons (machine addr ports protocols) machine-list));add-machine-alive addr)
2424
"No connection detected")))))
2525
(define (dispatch message)
26-
;(define machine-list '())
2726
(set! machine-list (map (lambda (open-ip) (machine open-ip ports protocols)) target-machine-ips))
2827
(cond((eq? (car message) 'up) target-machine-ips)
2928
((eq? (car message) 'machines) machine-list )
@@ -46,7 +45,8 @@
4645
;#t
4746
;>
4847

49-
48+
(define (all-tports)
49+
(for-each (lambda (machine-dispatch) (printf "IP:\n~a\nOpen ports:\n~s\n\n" (machine-dispatch '(ip)) (machine-dispatch '(tports)) )) machine-list))
5050
(define (check-tports port)
5151
(map (lambda (machine-dispatch) (if(machine-dispatch (list 'tport port)) (machine-dispatch '(ip)) " ")) machine-list))
5252

@@ -83,7 +83,6 @@
8383
(define (check-tport port)
8484
(if (memq (string->number port) open-tcp) #t #f))
8585
(define (probe-tcp ip port)
86-
(display "MAKING THREAD")
8786
(thread (lambda () (with-handlers ([exn:fail? (lambda (exn) exn )])
8887
(if
8988
(let-values (((input output) (tcp-connect ip port))) (list input output))

0 commit comments

Comments
 (0)