Udostępnij za pośrednictwem


SSLSocketFactory.CreateSocket(Socket, String, Int32, Boolean) Method

Definition

Returns a socket layered over an existing socket connected to the named host, at the given port.

[Android.Runtime.Register("createSocket", "(Ljava/net/Socket;Ljava/lang/String;IZ)Ljava/net/Socket;", "GetCreateSocket_Ljava_net_Socket_Ljava_lang_String_IZHandler")]
public abstract Java.Net.Socket? CreateSocket (Java.Net.Socket? s, string? host, int port, bool autoClose);
[<Android.Runtime.Register("createSocket", "(Ljava/net/Socket;Ljava/lang/String;IZ)Ljava/net/Socket;", "GetCreateSocket_Ljava_net_Socket_Ljava_lang_String_IZHandler")>]
override this.CreateSocket : Java.Net.Socket * string * int * bool -> Java.Net.Socket

Parameters

s
Socket

the existing socket

host
String

the server host

port
Int32

the server port

autoClose
Boolean

close the underlying socket when this socket is closed

Returns

a socket connected to the specified host and port

Attributes

Exceptions

if creating the socket fails.

if the host is unknown.

Remarks

Returns a socket layered over an existing socket connected to the named host, at the given port. This constructor can be used when tunneling SSL through a proxy or when negotiating the use of SSL over an existing socket. The host and port refer to the logical peer destination. This socket is configured using the socket options established for this factory.

Java documentation for javax.net.ssl.SSLSocketFactory.createSocket(java.net.Socket, java.lang.String, int, boolean).

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