1 21 package com.db4o.foundation.network; 22 23 import java.io.*; 24 import java.net.*; 25 26 public class YapServerSocket { 27 28 private ServerSocket _serverSocket; 29 30 public YapServerSocket(int port) throws IOException { 31 _serverSocket = new ServerSocket(port); 32 } 33 34 public void setSoTimeout(int timeout) { 35 try { 36 _serverSocket.setSoTimeout(timeout); 37 } catch (SocketException e) { 38 e.printStackTrace(); 39 } 40 } 41 42 public int getLocalPort() { 43 return _serverSocket.getLocalPort(); 44 } 45 46 public YapSocket accept() throws IOException { 47 Socket sock = _serverSocket.accept(); 48 return new YapSocketReal(sock); 50 } 51 52 public void close() throws IOException { 53 _serverSocket.close(); 54 } 55 56 } 57 | Popular Tags |