gvsu/cs654/proj1/KaZaServer.java
josh c84d3e4b0b server accepting connections
git-svn-id: svn://anubis/gvsu@29 45c1a28c-8058-47b2-ae61-ca45b979098e
2008-03-08 18:29:47 +00:00

49 lines
994 B
Java

import java.io.*;
import java.net.*;
import java.util.*;
public class KaZaServer implements Runnable
{
public static final int LISTEN_PORT = 3442;
private ServerSocket m_serverSocket;
public void run()
{
try {
m_serverSocket = new ServerSocket(LISTEN_PORT);
/* porcess connection requests */
for (;;)
{
Socket clientSocket = m_serverSocket.accept();
Thread thread = new Thread(new ClientHandler(clientSocket));
thread.start();
}
} catch (IOException ioe) {
System.out.println("IO Exception!");
ioe.printStackTrace();
return;
}
}
public void close()
{
}
private class ClientHandler implements Runnable
{
Socket m_socket;
public ClientHandler(Socket socket)
{
m_socket = socket;
}
public void run()
{
}
}
}