Share via


SocketImpl.Connect Method

Definition

Overloads

Connect(String, Int32)

Connects this socket to the specified port on the named host.

Connect(InetAddress, Int32)

Connects this socket to the specified port number on the specified host.

Connect(SocketAddress, Int32)

Connects this socket to the specified port number on the specified host.

Connect(String, Int32)

Connects this socket to the specified port on the named host.

[Android.Runtime.Register("connect", "(Ljava/lang/String;I)V", "GetConnect_Ljava_lang_String_IHandler")]
protected abstract void Connect (string? host, int port);
[<Android.Runtime.Register("connect", "(Ljava/lang/String;I)V", "GetConnect_Ljava_lang_String_IHandler")>]
abstract member Connect : string * int -> unit

Parameters

host
String

the name of the remote host.

port
Int32

the port number.

Attributes

Exceptions

if an error occurs while connecting to the remote host.

Remarks

Connects this socket to the specified port on the named host.

Java documentation for java.net.SocketImpl.connect(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

Connect(InetAddress, Int32)

Connects this socket to the specified port number on the specified host.

[Android.Runtime.Register("connect", "(Ljava/net/InetAddress;I)V", "GetConnect_Ljava_net_InetAddress_IHandler")]
protected abstract void Connect (Java.Net.InetAddress? address, int port);
[<Android.Runtime.Register("connect", "(Ljava/net/InetAddress;I)V", "GetConnect_Ljava_net_InetAddress_IHandler")>]
abstract member Connect : Java.Net.InetAddress * int -> unit

Parameters

address
InetAddress

the IP address of the remote host.

port
Int32

the port number.

Attributes

Exceptions

if an error occurs while connecting to the remote host.

Remarks

Connects this socket to the specified port number on the specified host.

Java documentation for java.net.SocketImpl.connect(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

Connect(SocketAddress, Int32)

Connects this socket to the specified port number on the specified host.

[Android.Runtime.Register("connect", "(Ljava/net/SocketAddress;I)V", "GetConnect_Ljava_net_SocketAddress_IHandler")]
protected abstract void Connect (Java.Net.SocketAddress? address, int timeout);
[<Android.Runtime.Register("connect", "(Ljava/net/SocketAddress;I)V", "GetConnect_Ljava_net_SocketAddress_IHandler")>]
abstract member Connect : Java.Net.SocketAddress * int -> unit

Parameters

address
SocketAddress

the Socket address of the remote host.

timeout
Int32

the timeout value, in milliseconds, or zero for no timeout.

Attributes

Exceptions

if an error occurs while connecting.

Remarks

Connects this socket to the specified port number on the specified host. A timeout of zero is interpreted as an infinite timeout. The connection will then block until established or an error occurs.

Added in 1.4.

Java documentation for java.net.SocketImpl.connect(java.net.SocketAddress, 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