This commit was manufactured by cvs2svn to create tag 'buildscript'.
[IRC.git] /
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() {
22     } {td};
23     int newfd=nativeaccept(s);
24     s.setFD(newfd);
25     return s;
26   }
27
28   /* Lets caller pass in their own Socket object. */
29   public void accept(Socket s) {
30     int newfd=nativeaccept(s);
31     s.setFD(newfd);
32   }
33
34   private native int nativeaccept(Socket s);
35
36   public void close();
37
38 }