다음을 통해 공유


ServerSocket.Accept Method

Definition

Listens for a connection to be made to this socket and accepts it.

[Android.Runtime.Register("accept", "()Ljava/net/Socket;", "GetAcceptHandler")]
public virtual Java.Net.Socket? Accept ();
[<Android.Runtime.Register("accept", "()Ljava/net/Socket;", "GetAcceptHandler")>]
abstract member Accept : unit -> Java.Net.Socket
override this.Accept : unit -> Java.Net.Socket

Returns

the new Socket

Attributes

Exceptions

if an error occurs while accepting a new connection.

Remarks

Listens for a connection to be made to this socket and accepts it. The method blocks until a connection is made.

A new Socket s is created and, if there is a security manager, the security manager's checkAccept method is called with s.getInetAddress().getHostAddress() and s.getPort() as its arguments to ensure the operation is allowed. This could result in a SecurityException.

Java documentation for java.net.ServerSocket.accept().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to