Mercurial > hg > Members > nobuyasu > konoha
view echoServer/echoServer.k @ 1:68307ce6839d
add some files
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 14 May 2012 13:22:21 +0900 |
parents | 536b29f11352 |
children |
line wrap: on
line source
using konoha.socket.*; using konoha.io.*; void main(String[] args) { int port = 8888; print "port number = " + port; ServerSocket servSock = new ServerSocket(port, 1); print "accept..." Socket sock = servSock.accept(); print "client connected" InputStream in = sock.getInputStream(); OutputSteram out = sock.getOutputStream(); while ( !in.isClosed() ) { String b = in.readLine(); print b; out <<< b <<< EOL; out.flush(); } out.close(); in.close(); }