Subversion Repositories programming

Rev

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

Rev 222 Rev 223
Line 26... Line 26...
26
            String inputLine, outputLine;
26
            String inputLine, outputLine;
27
            DHCPTableEntry e, expired;
27
            DHCPTableEntry e, expired;
28
 
28
 
29
            // Try to get REQ message
29
            // Try to get REQ message
30
            inputLine = in.readLine();
30
            inputLine = in.readLine();
-
 
31
            String[] splitInput = inputLine.split(" ");
31
 
32
            
-
 
33
            if (splitInput.length != 3 && 
-
 
34
                !splitInput[0].equals("req") && 
32
            if (!inputLine.equals("req"))
35
                !splitInput[1].equals("IP"))
-
 
36
            {
33
                System.err.println ("REQ was not the first message!");
37
                System.err.println ("REQ was not the first message!");
-
 
38
                out.println ("BAD REQUEST");
-
 
39
                return; // Leave uncleanly
-
 
40
            }
34
 
41
 
35
            // Try to get HW Address
-
 
36
            String HWAddr = in.readLine();
-
 
37
            e = table.addEntry (HWAddr);
42
            e = table.addEntry (splitInput[2]);
38
 
43
 
39
            // Print out DHCP Server info
44
            // Print out DHCP Server info
40
            System.out.printf ("Client Added: IP=%s -- HW=%s\n", e.getIPAddr(), e.getHWAddr());
45
            System.out.printf ("Client Added: IP=%s -- HW=%s\n", e.getIPAddr(), e.getHWAddr());
41
 
46
 
42
            // Send out the client's IP Address
47
            // Send out the client's IP Address