Sdílet prostřednictvím


ISocketFactory.IsSecure(Socket) Method

Definition

Checks whether a socket provides a secure connection.

[Android.Runtime.Register("isSecure", "(Ljava/net/Socket;)Z", "GetIsSecure_Ljava_net_Socket_Handler:Org.Apache.Http.Conn.Schemes.ISocketFactoryInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public bool IsSecure (Java.Net.Socket? sock);
[<Android.Runtime.Register("isSecure", "(Ljava/net/Socket;)Z", "GetIsSecure_Ljava_net_Socket_Handler:Org.Apache.Http.Conn.Schemes.ISocketFactoryInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member IsSecure : Java.Net.Socket -> bool

Parameters

sock
Socket

the connected socket to check

Returns

true if the connection of the socket should be considered secure, or false if it should not

Attributes

Exceptions

if the argument is invalid, for example because it is not a connected socket or was created by a different socket factory. Note that socket factories are not required to check these conditions, they may simply return a default value when called with an invalid socket argument.

Remarks

Checks whether a socket provides a secure connection. The socket must be #connectSocket connected by this factory. The factory will not perform I/O operations in this method. <br/> As a rule of thumb, plain sockets are not secure and TLS/SSL sockets are secure. However, there may be application specific deviations. For example, a plain socket to a host in the same intranet ("trusted zone") could be considered secure. On the other hand, a TLS/SSL socket could be considered insecure based on the cypher suite chosen for the connection.

Java documentation for org.apache.http.conn.scheme.SocketFactory.isSecure(java.net.Socket).

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