Sdílet prostřednictvím


SSLCertificateSocketFactory.CreateSocket Method

Definition

Overloads

CreateSocket(InetAddress, Int32)
Obsolete.

To be added

CreateSocket(String, Int32)
Obsolete.

To be added

CreateSocket(InetAddress, Int32, InetAddress, Int32)
Obsolete.

To be added

CreateSocket(Socket, String, Int32, Boolean)
Obsolete.

To be added

CreateSocket(String, Int32, InetAddress, Int32)
Obsolete.

To be added

CreateSocket(InetAddress, Int32)

Caution

deprecated

To be added

[Android.Runtime.Register("createSocket", "(Ljava/net/InetAddress;I)Ljava/net/Socket;", "GetCreateSocket_Ljava_net_InetAddress_IHandler")]
[System.Obsolete("deprecated")]
public override Java.Net.Socket? CreateSocket (Java.Net.InetAddress? addr, int port);
[<Android.Runtime.Register("createSocket", "(Ljava/net/InetAddress;I)Ljava/net/Socket;", "GetCreateSocket_Ljava_net_InetAddress_IHandler")>]
[<System.Obsolete("deprecated")>]
override this.CreateSocket : Java.Net.InetAddress * int -> Java.Net.Socket

Parameters

addr
InetAddress

the host address the socket has to be connected to.

port
Int32

the port number of the remote host at which the socket is connected.

Returns

Attributes

Exceptions

Remarks

To be added

This method returns a socket that is not connected.

<p class="caution"><b>Warning:</b> Hostname verification is not performed with this method. You MUST verify the server's identity after connecting the socket to avoid person-in-the-middle attacks.

Java documentation for android.net.SSLCertificateSocketFactory.createSocket(java.net.InetAddress, int).

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

CreateSocket(String, Int32)

Caution

deprecated

To be added

[Android.Runtime.Register("createSocket", "(Ljava/lang/String;I)Ljava/net/Socket;", "GetCreateSocket_Ljava_lang_String_IHandler")]
[System.Obsolete("deprecated")]
public override Java.Net.Socket? CreateSocket (string? host, int port);
[<Android.Runtime.Register("createSocket", "(Ljava/lang/String;I)Ljava/net/Socket;", "GetCreateSocket_Ljava_lang_String_IHandler")>]
[<System.Obsolete("deprecated")>]
override this.CreateSocket : string * int -> Java.Net.Socket

Parameters

host
String

the remote host address the socket has to be connected to.

port
Int32

the port number of the remote host at which the socket is connected.

Returns

Attributes

Exceptions

Remarks

To be added

By default, this method returns a connected socket and verifies the peer's certificate hostname after connecting using the HostnameVerifier obtained from HttpsURLConnection.getDefaultHostnameVerifier(); if this instance was created with #getInsecure(int, SSLSessionCache), it returns a socket that is not connected instead.

Java documentation for android.net.SSLCertificateSocketFactory.createSocket(java.lang.String, int).

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

CreateSocket(InetAddress, Int32, InetAddress, Int32)

Caution

deprecated

To be added

[Android.Runtime.Register("createSocket", "(Ljava/net/InetAddress;ILjava/net/InetAddress;I)Ljava/net/Socket;", "GetCreateSocket_Ljava_net_InetAddress_ILjava_net_InetAddress_IHandler")]
[System.Obsolete("deprecated")]
public override Java.Net.Socket? CreateSocket (Java.Net.InetAddress? addr, int port, Java.Net.InetAddress? localAddr, int localPort);
[<Android.Runtime.Register("createSocket", "(Ljava/net/InetAddress;ILjava/net/InetAddress;I)Ljava/net/Socket;", "GetCreateSocket_Ljava_net_InetAddress_ILjava_net_InetAddress_IHandler")>]
[<System.Obsolete("deprecated")>]
override this.CreateSocket : Java.Net.InetAddress * int * Java.Net.InetAddress * int -> Java.Net.Socket

Parameters

addr
InetAddress

the remote host address the socket has to be connected to.

port
Int32

the port number of the remote host at which the socket is connected.

localAddr
InetAddress

the local host address the socket is bound to.

localPort
Int32

the port number of the local host at which the socket is bound.

Returns

Attributes

Exceptions

Remarks

To be added

This method returns a socket that is not connected.

<p class="caution"><b>Warning:</b> Hostname verification is not performed with this method. You MUST verify the server's identity after connecting the socket to avoid person-in-the-middle attacks.

Java documentation for android.net.SSLCertificateSocketFactory.createSocket(java.net.InetAddress, int, java.net.InetAddress, int).

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

CreateSocket(Socket, String, Int32, Boolean)

Caution

deprecated

To be added

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

Parameters

k
Socket

the socket.

host
String

the host.

port
Int32

the port number.

close
Boolean

true if socket s should be closed when the created socket is closed, false if the socket s should be left open.

Returns

Attributes

Exceptions

Remarks

To be added

By default, this method returns a connected socket and verifies the peer's certificate hostname after connecting using the HostnameVerifier obtained from HttpsURLConnection.getDefaultHostnameVerifier(); if this instance was created with #getInsecure(int, SSLSessionCache), it returns a socket that is not connected instead.

Java documentation for android.net.SSLCertificateSocketFactory.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

CreateSocket(String, Int32, InetAddress, Int32)

Caution

deprecated

To be added

[Android.Runtime.Register("createSocket", "(Ljava/lang/String;ILjava/net/InetAddress;I)Ljava/net/Socket;", "GetCreateSocket_Ljava_lang_String_ILjava_net_InetAddress_IHandler")]
[System.Obsolete("deprecated")]
public override Java.Net.Socket? CreateSocket (string? host, int port, Java.Net.InetAddress? localAddr, int localPort);
[<Android.Runtime.Register("createSocket", "(Ljava/lang/String;ILjava/net/InetAddress;I)Ljava/net/Socket;", "GetCreateSocket_Ljava_lang_String_ILjava_net_InetAddress_IHandler")>]
[<System.Obsolete("deprecated")>]
override this.CreateSocket : string * int * Java.Net.InetAddress * int -> Java.Net.Socket

Parameters

host
String

the remote host address the socket has to be connected to.

port
Int32

the port number of the remote host at which the socket is connected.

localAddr
InetAddress

the local host address the socket is bound to.

localPort
Int32

the port number of the local host at which the socket is bound.

Returns

Attributes

Exceptions

Remarks

To be added

By default, this method returns a connected socket and verifies the peer's certificate hostname after connecting using the HostnameVerifier obtained from HttpsURLConnection.getDefaultHostnameVerifier(); if this instance was created with #getInsecure(int, SSLSessionCache), it returns a socket that is not connected instead.

Java documentation for android.net.SSLCertificateSocketFactory.createSocket(java.lang.String, int, java.net.InetAddress, int).

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