view echoServer/echoServer.k @ 0:536b29f11352

add some files
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Sat, 28 Apr 2012 21:01:53 +0900
parents
children 68307ce6839d
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 "accepted"

	InputStream in = sock.getInputStream();
	OutputSteram out = sock.getOutputStream();

	while ( !in.isClosed() ) {
		String b = in.readLine();
		print b;
		out <<< b <<< EOL;
		out.flush();
	}
}