Java Doc for ServerSocket.java in  » Apache-Harmony-Java-SE » java-package » java » net » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » java package » java.net 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.net.ServerSocket

ServerSocket
public class ServerSocket (Code)
ServerSocket create connections between 'host' and 'client' machines. The ServerSocket listens on a well known port and upon a connection request, instantiates a 'host' sockets, which carries on future communication with the requesting 'client' socket, so that the server socket may continue listening for connection requests. They are passive objects, having no execution thread of their own to listen on.


Field Summary
static  SocketImplFactoryfactory
    
 SocketImplimpl
    

Constructor Summary
public  ServerSocket()
     Construct a ServerSocket, which is not bound to any port.
protected  ServerSocket(SocketImpl impl)
    
public  ServerSocket(int aport)
     Construct a ServerSocket, bound to the nominated port on the default localhost.
public  ServerSocket(int aport, int backlog)
     Construct a ServerSocket, bound to the nominated port on the default localhost.
public  ServerSocket(int aport, int backlog, InetAddress localAddr)
     Construct a ServerSocket, bound to the nominated local host/port.

Method Summary
public  Socketaccept()
     Retrieve the first connection request and answer the 'host' socket that will conduct further communications with the requesting 'client' socket.
public  voidbind(SocketAddress localAddr)
     Bind the ServerSocket to the nominated local host/port.
public  voidbind(SocketAddress localAddr, int backlog)
     Bind the ServerSocket to the nominated local host/port.
 voidcheckListen(int aPort)
     Check whether the server may listen for connection requests on aport.
public  voidclose()
     Close this server socket.
static  intdefaultBacklog()
     Answer the default number of pending connections on a server socket.
public  ServerSocketChannelgetChannel()
    
public  InetAddressgetInetAddress()
     Answer the local IP address for this server socket.
public  intgetLocalPort()
     Answer the local port for this server socket.
public  SocketAddressgetLocalSocketAddress()
     Answer the local SocketAddress for this server socket, or null if the socket is not bound.
public  intgetReceiveBufferSize()
     Answer the socket receive buffer size (SO_RCVBUF).
public  booleangetReuseAddress()
     Get the state of the SO_REUSEADDR socket option.
public synchronized  intgetSoTimeout()
     Answer the time-out period of this server socket.
final protected  voidimplAccept(Socket aSocket)
     Invoke the server socket implementation to accept a connection on the newly created aSocket.
public  booleanisBound()
     Return if the server socket is bound to a local address and port.
public  booleanisClosed()
     Return if the server socket is closed.
public  voidsetPerformancePreferences(int connectionTime, int latency, int bandwidth)
    
public  voidsetReceiveBufferSize(int size)
     Set the socket receive buffer size.
public  voidsetReuseAddress(boolean reuse)
     Set the SO_REUSEADDR socket option.
public synchronized  voidsetSoTimeout(int timeout)
     Set the listen time-out period for this server socket.
public static synchronized  voidsetSocketFactory(SocketImplFactory aFactory)
     Set the server socket implementation factory.
public  StringtoString()
     Answers a string containing a concise, human-readable description of the server socket.

Field Detail
factory
static SocketImplFactory factory(Code)



impl
SocketImpl impl(Code)




Constructor Detail
ServerSocket
public ServerSocket() throws IOException(Code)
Construct a ServerSocket, which is not bound to any port. The default number of pending connections may be backlogged.
See Also:   Socket



ServerSocket
protected ServerSocket(SocketImpl impl)(Code)



ServerSocket
public ServerSocket(int aport) throws IOException(Code)
Construct a ServerSocket, bound to the nominated port on the default localhost. The default number of pending connections may be backlogged.
Parameters:
  aport - the port number to listen for connection requests on
See Also:   Socket



ServerSocket
public ServerSocket(int aport, int backlog) throws IOException(Code)
Construct a ServerSocket, bound to the nominated port on the default localhost. The number of pending connections that may be backlogged is a specified.
Parameters:
  aport - the port number to listen for connection requests on
Parameters:
  backlog - the number of pending connection requests, before requests arerejected
See Also:   Socket



ServerSocket
public ServerSocket(int aport, int backlog, InetAddress localAddr) throws IOException(Code)
Construct a ServerSocket, bound to the nominated local host/port. The number of pending connections that may be backlogged is a specified.
Parameters:
  aport - the port number to listen for connection requests on
Parameters:
  localAddr - the local machine address to bind on
Parameters:
  backlog - the number of pending connection requests, before requests arerejected
See Also:   Socket




Method Detail
accept
public Socket accept() throws IOException(Code)
Retrieve the first connection request and answer the 'host' socket that will conduct further communications with the requesting 'client' socket. Socket the 'host' socket
exception:
  IOException - if an error occurs while instantiating the 'host' socket



bind
public void bind(SocketAddress localAddr) throws IOException(Code)
Bind the ServerSocket to the nominated local host/port. The default number of pending connections may be backlogged.
Parameters:
  localAddr - the local machine address and port to bind on
exception:
  IllegalArgumentException - if the SocketAddress is not supported
exception:
  IOException - if the socket is already bound, or a problem occurs duringthe bind



bind
public void bind(SocketAddress localAddr, int backlog) throws IOException(Code)
Bind the ServerSocket to the nominated local host/port. The number of pending connections that may be backlogged is a specified.
Parameters:
  localAddr - the local machine address and port to bind on
Parameters:
  backlog - the number of pending connection requests, before requests arerejected
exception:
  IllegalArgumentException - if the SocketAddress is not supported
exception:
  IOException - if the socket is already bound, or a problem occurs duringthe bind



checkListen
void checkListen(int aPort)(Code)
Check whether the server may listen for connection requests on aport. Throw an exception if the port is outside the valid range or does not satisfy the security policy.
Parameters:
  aPort - the candidate port to listen on



close
public void close() throws IOException(Code)
Close this server socket. Any attempt to connect to this socket thereafter will fail.



defaultBacklog
static int defaultBacklog()(Code)
Answer the default number of pending connections on a server socket. int the default number of pending connection requests



getChannel
public ServerSocketChannel getChannel()(Code)
if ServerSocket is created by a ServerSocketChannel, returns the related ServerSocketChannel the related ServerSocketChannel if any



getInetAddress
public InetAddress getInetAddress()(Code)
Answer the local IP address for this server socket. Return null if the socket is not bound. This is useful on multihomed hosts. InetAddress the local address



getLocalPort
public int getLocalPort()(Code)
Answer the local port for this server socket. Return -1 if the socket is not bound. int the local port the server is listening on



getLocalSocketAddress
public SocketAddress getLocalSocketAddress()(Code)
Answer the local SocketAddress for this server socket, or null if the socket is not bound. This is useful on multihomed hosts.



getReceiveBufferSize
public int getReceiveBufferSize() throws SocketException(Code)
Answer the socket receive buffer size (SO_RCVBUF). int socket receive buffer size



getReuseAddress
public boolean getReuseAddress() throws SocketException(Code)
Get the state of the SO_REUSEADDR socket option.



getSoTimeout
public synchronized int getSoTimeout() throws IOException(Code)
Answer the time-out period of this server socket. This is the time the server will wait listening for connections, before exiting. int the listening timeout
exception:
  SocketException - thrown if option cannot be retrieved



implAccept
final protected void implAccept(Socket aSocket) throws IOException(Code)
Invoke the server socket implementation to accept a connection on the newly created aSocket.
Parameters:
  aSocket - the concrete socketImpl to accept the connection request on
exception:
  IOException - thrown if connection cannot be accepted



isBound
public boolean isBound()(Code)
Return if the server socket is bound to a local address and port.



isClosed
public boolean isClosed()(Code)
Return if the server socket is closed.



setPerformancePreferences
public void setPerformancePreferences(int connectionTime, int latency, int bandwidth)(Code)
sets performance preference for connectionTime,latency and bandwidth
Parameters:
  connectionTime - the importance of connect time
Parameters:
  latency - the importance of latency
Parameters:
  bandwidth - the importance of bandwidth



setReceiveBufferSize
public void setReceiveBufferSize(int size) throws SocketException(Code)
Set the socket receive buffer size.
Parameters:
  size - the buffer size, in bytes
exception:
  java.net.SocketException - If an error occurs while setting the size or the size isinvalid.



setReuseAddress
public void setReuseAddress(boolean reuse) throws SocketException(Code)
Set the SO_REUSEADDR socket option.
Parameters:
  reuse - the socket SO_REUSEADDR option setting



setSoTimeout
public synchronized void setSoTimeout(int timeout) throws SocketException(Code)
Set the listen time-out period for this server socket.
Parameters:
  timeout - the time to wait for a connection request
exception:
  SocketException - thrown if an error occurs during setting the option



setSocketFactory
public static synchronized void setSocketFactory(SocketImplFactory aFactory) throws IOException(Code)
Set the server socket implementation factory. This method may only be invoked with sufficient security and only once during the application lifetime.
Parameters:
  aFactory - the streaming socket factory to be used for further socketinstantiations
exception:
  IOException - thrown if the factory is already set



toString
public String toString()(Code)
Answers a string containing a concise, human-readable description of the server socket. The port field is reported a zero, as there is no connection formed to the server. String the description



Methods inherited from java.lang.Object
protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object object)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final public Class<? extends Object> getClass()(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
final public void notify()(Code)(Java Doc)
final public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final public void wait(long millis, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait(long millis) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.