remove some codes for scheduling
[IRC.git] / Robust / src / ClassLibrary / ServerSocket.java
1 public class ServerSocket {
2     /* Socket pending flag */
3     external flag SocketPending;    
4     /* File Descriptor */
5     int fd;
6
7     private native int createSocket(int port);
8
9     public ServerSocket(int port) {
10         this.fd=createSocket(port);
11     }
12     
13     public Socket accept() {
14         Socket s=new Socket();
15         int newfd=nativeaccept(s);
16         s.setFD(newfd);
17         return s;
18     }
19
20     public Socket accept(tag td) {
21         Socket s=new Socket(){}{td};
22         int newfd=nativeaccept(s);
23         s.setFD(newfd);
24         return s;
25     }
26
27     /* Lets caller pass in their own Socket object. */
28     public void accept(Socket s) {
29         int newfd=nativeaccept(s);
30         s.setFD(newfd);
31     }
32
33     private native int nativeaccept(Socket s);
34     
35     public void close();
36
37 }