Mercurial > hg > Members > nobuyasu > TestNeo4j
changeset 7:5e69f162d307 draft
add CheckRequest.java
author | one |
---|---|
date | Sat, 18 Aug 2012 21:41:19 +0900 |
parents | 86924c16b4df |
children | d8d0855bcdfd |
files | src/begin/CheckRequest.java |
diffstat | 1 files changed, 40 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/begin/CheckRequest.java Sat Aug 18 21:41:19 2012 +0900 @@ -0,0 +1,40 @@ +package begin; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.ServerSocket; +import java.net.Socket; + + + +public class CheckRequest { + + final static int PORT = 9999; + + public static void main(String[] args) { + try { + ServerSocket serverSock = new ServerSocket(PORT); + + System.out.println("Open port number = "+ PORT); + System.out.println("Please accept now..."); + Socket sock = serverSock.accept(); + System.out.println("connected"); + + BufferedReader is = new BufferedReader(new InputStreamReader(sock.getInputStream())); + + String line; + while ((line = is.readLine()) != null ) { + System.out.println(line); + } + sock.close(); + + + } catch (IOException e) { + e.printStackTrace(); + } + + + + } +}