Subversion Repositories programming

Rev

Rev 186 | Rev 188 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 186 Rev 187
Line 14... Line 14...
14
import java.io.*;
14
import java.io.*;
15
import java.net.*;
15
import java.net.*;
16
 
16
 
17
public class P1Server
17
public class P1Server
18
{
18
{
19
    public final int portNumber = 1337;
19
    public static final int portNumber = 1337;
20
 
20
 
-
 
21
    /**
-
 
22
     * Method: main()
-
 
23
     * Purpose: This method creates a listening socket on port 1337 and
-
 
24
     * accepts the first connection made to it. It then echoes back anything
-
 
25
     * sent to it, until it recieves a "QUIT", at which point it terminates.
-
 
26
     */
21
    public static void main (String[] args) throws IOException
27
    public static void main (String[] args) throws IOException
22
    {
28
    {
23
        ServerSocket serverSocket = null;
29
        ServerSocket serverSocket = null;
24
 
30
 
25
        /* Try to open the port for listening */
31
        /* Try to open the port for listening */
Line 70... Line 76...
70
        out.close();
76
        out.close();
71
        in.close();
77
        in.close();
72
        clientSocket.close();
78
        clientSocket.close();
73
        serverSocket.close();
79
        serverSocket.close();
74
    }
80
    }
75
 
-
 
76
}
81
}
77
 
82