needs lib/coop com/net com/ip4 com/tcp unit bench/tcp createapplication TCPEcho :> evarg1 if evarg1 TCPCon.tag n"ECHO" = if -1 evarg1 readbuf ?dup if ( a u ) ."tcpecho: " 2dup rtype nl> evarg1 writebuf drop then then else ."tcpecho accepting " SourceAddr .addr .":" DestPort . nl> acceptcon ?dup not ?abort"out of TCP connections" to evarg1 n"ECHO" evarg1 to TCPCon.tag then ; IP4TCPRECV TCPEcho sethandler ' stopcurrent KEYPRESS TCPEcho sethandler TCPEcho newcontext const tcpechoctx : tcpecho tcpechoctx launchcontext ;