1
package org.devioux.jmeeting.client;
8
public void dataListener(int port) throws IOException {
9
ServerSocket serverSocket = null;
12
serverSocket = new ServerSocket(port);
13
} catch (IOException e) {
14
System.err.println("Could not listen on port: " + port);
18
Socket clientSocket = null;
20
clientSocket = serverSocket.accept();
21
} catch (IOException e) {
22
System.err.println("Accept failed.");
26
PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
27
BufferedReader in = new BufferedReader(
28
new InputStreamReader(clientSocket.getInputStream()));
29
String inputLine, outputLine;
30
JProtocol jp = new JProtocol();
32
outputLine = jp.processInput(null);
33
out.println(outputLine);
35
while ((inputLine = in.readLine()) != null) {
36
outputLine = jp.processInput(inputLine);
37
out.println(outputLine);
38
if (outputLine.equals("Bye."))
47
public static void main(String[] args) throws IOException {
48
new JServer().dataListener(1208);