1 public class ServerSocket {
2 /* Socket pending flag */
3 external flag SocketPending;
7 private native int createSocket(int port);
9 public ServerSocket(int port) {
10 this.fd=createSocket(port);
13 public Socket accept() {
14 Socket s=new Socket();
15 int newfd=nativeaccept(s);
20 public Socket accept(tag td) {
21 Socket s=new Socket() {
23 int newfd=nativeaccept(s);
28 /* Lets caller pass in their own Socket object. */
29 public void accept(Socket s) {
30 int newfd=nativeaccept(s);
34 private native int nativeaccept(Socket s);