KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > java > net > ServerSocket

java.net
Class ServerSocket

java.lang.Object
  extended by java.net.ServerSocket
Direct Known Subclasses:
SSLServerSocket
See Also:
Top Examples, Source Code, SocketImpl, setSocketFactory(java.net.SocketImplFactory), ServerSocketChannel

public Socket accept()
              throws IOException
See Also:
SecurityManager.checkAccept(java.lang.String, int), IllegalBlockingModeException, SocketTimeoutException, SecurityException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[18]Very basic HTTP server
By Anonymous on 2005/03/23 05:28:28  Rate
public class HTTPServer  {  
    public static void main ( String a [  ]  )  throws Exception  {  
    final int httpd = 80; 
     
    ServerSocket ssock = new ServerSocket ( httpd ) ; 
    System.out.println ( "have opened port 80 locally" ) ; 
     
    Socket sock = ssock.accept (  ) ; 
    System.out.println ( "client has made socket connection" ) ; 
     
    OneConnection client = new OneConnection ( sock ) ; 
    String s = client.getRequest (  ) ; 
    }  
  } 


public void bind(SocketAddress endpoint)
          throws IOException
See Also:
IllegalArgumentException, SecurityException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void bind(SocketAddress endpoint,
                 int backlog)
          throws IOException
See Also:
IllegalArgumentException, SecurityException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void close()
           throws IOException
See Also:
SocketException, accept()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public ServerSocketChannel getChannel()
See Also:
ServerSocketChannel.open
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public InetAddress getInetAddress()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int getLocalPort()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public SocketAddress getLocalSocketAddress()
See Also:
bind(SocketAddress), getLocalPort(), getInetAddress()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int getReceiveBufferSize()
                         throws SocketException
See Also:
setReceiveBufferSize(int)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean getReuseAddress()
                        throws SocketException
See Also:
setReuseAddress(boolean)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int getSoTimeout()
                 throws IOException
See Also:
setSoTimeout(int)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected final void implAccept(Socket s)
                         throws IOException
See Also:
IllegalBlockingModeException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean isBound()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean isClosed()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public ServerSocket()
             throws IOException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public ServerSocket(int port)
             throws IOException
See Also:
SecurityManager.checkListen(int), setSocketFactory(java.net.SocketImplFactory), SocketImplFactory.createSocketImpl(), SocketImpl, SecurityException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public ServerSocket(int port,
                    int backlog)
             throws IOException
See Also:
SecurityManager.checkListen(int), setSocketFactory(java.net.SocketImplFactory), SocketImplFactory.createSocketImpl(), SocketImpl, SecurityException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public ServerSocket(int port,
                    int backlog,
                    InetAddress bindAddr)
             throws IOException
See Also:
SecurityManager.checkListen(int), SocketImpl, SocketOptions, SecurityException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setPerformancePreferences(int connectionTime,
                                      int latency,
                                      int bandwidth)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1401]ServerSocket.setPerformancePreferences is not yet implemented in Java5
By Anonymous on 2005/04/26 02:28:41  Rate
not yet implemented in Java5

public void setReceiveBufferSize(int size)
                          throws SocketException
See Also:
getReceiveBufferSize(), IllegalArgumentException, accept(), Socket.getReceiveBufferSize()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setReuseAddress(boolean on)
                     throws SocketException
See Also:
isClosed(), isBound(), bind(SocketAddress), getReuseAddress()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static void setSocketFactory(SocketImplFactory fac)
                             throws IOException
See Also:
SecurityManager.checkSetFactory(), SocketImplFactory.createSocketImpl(), SecurityException, SocketException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setSoTimeout(int timeout)
                  throws SocketException
See Also:
getSoTimeout()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String toString()
See Also:
Object
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags