DotMSN |

# ProxySocket.Connect Method (String, Int32)

Establishes a connection to a remote device.

[Visual Basic]
Overloads Public Sub Connect( _
ByVal host As String, _
ByVal port As Integer _
)
[C#]
new public void Connect(
string host,
int port
);

#### Parameters

host
  The remote host to connect to.
port
  The remote port to connect to.

#### Remarks

If you use this method with a SOCKS4 server, it will let the server resolve the hostname. Not all SOCKS4 servers support this 'remote DNS' though.

#### Exceptions

Exception Type | Condition
--- | ---
ArgumentNullException | The host parameter is a null reference (Nothing in Visual Basic).
ArgumentException | The port parameter is invalid.
SocketException | An operating system error occurs while accessing the Socket.
ObjectDisposedException | The Socket has been closed.
ProxyException | An error Occurred while talking to the proxy server.

#### See Also

ProxySocket Class | Org.Mentalis.Network.ProxySocket Namespace | ProxySocket.Connect Overload List