-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAuctionServer.java
39 lines (31 loc) · 1.03 KB
/
AuctionServer.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
/**
*
* @author Hishan Indrajith
*/
public class AuctionServer {
public static final int BASE_PORT = 2000;
public static void main(String [] args){
//ServerController controller = new ServerController();
StockDB stockDataStruct = new StockDB();
OfferDB offerDatastruct = new OfferDB();
ServerController guiController = new ServerController();
Thread guiThread = new Thread(guiController);
guiThread.start();
AuctionServer server = new AuctionServer();
try {
server.serverLoop();
} catch (IOException ex) {
}
}
public void serverLoop() throws IOException {
ServerSocket serverSocket = new ServerSocket(BASE_PORT);
while(true) {
Socket socket = serverSocket.accept(); // if error must close the socket
Connection newConnection = new Connection(socket);
newConnection.startThread();
}
}
}