# This demonstrates how to use the connect command. 

proc main
var line pid sock fd

colour off
set sock [connect "localhost" 21]
set fd [open to write "/dev/tty"]

spawn pid
if pid
	# Get data from server.
	in sock
	input line
	while [not $eof]
		printnl line;  input line
	wend
	exit 0
endif

# Get user input and send to server.
out sock
while 1
	input line;  printnl line
wend
endproc