Last change
on this file since 34ccb37 was 34ccb37, checked in by ZeroCool <devnull@…>, 14 years ago |
Attempt at first cmmit. AGAIN :(
|
-
Property mode
set to
100644
|
File size:
814 bytes
|
Line | |
---|
1 | import java.io.IOException;
|
---|
2 | import java.net.ServerSocket;
|
---|
3 | import java.net.Socket;
|
---|
4 |
|
---|
5 |
|
---|
6 | public class ConnectionListener {
|
---|
7 | /*
|
---|
8 | * This thread listens for connections from clients.
|
---|
9 | */
|
---|
10 | public static boolean running = true;
|
---|
11 | private static ServerSocket socketServer;
|
---|
12 | private static GameServer gameServer;
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * @param args
|
---|
16 | */
|
---|
17 | public static void main(String[] args) {
|
---|
18 | gameServer = new GameServer();
|
---|
19 | try {
|
---|
20 | socketServer = new ServerSocket(1337);
|
---|
21 | while(running){
|
---|
22 | Socket clientSocket = null;
|
---|
23 | clientSocket = socketServer.accept();
|
---|
24 | System.out.println(clientSocket.getInetAddress()+ ":"+clientSocket.getPort());
|
---|
25 | gameServer.addConnection(clientSocket);
|
---|
26 | }
|
---|
27 | } catch (IOException e) {
|
---|
28 | System.out.println("Accept failed: 1337");
|
---|
29 | System.exit(-1);
|
---|
30 | }
|
---|
31 | }
|
---|
32 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.