See Also

Tcp Class  | Tcp Members  | Overload List

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP, Windows Server 2003, Windows Vista

Language

Visual Basic

C#

C++

C++/CLI

Show All

server
Remote hostname or address in dot notation.
serverPort
Remote port, a number between 1 and 65535, inclusive.
client
Optional local hostname or address in dot notation. Use "" as default.
clientPort
Optional local port, a number between 1 and 65535, inclusive. Use 0 as default.
See Also Languages PowerTCP Email Validation for .NET

Connect(String,Int32,String,Int32) Method

Dart.PowerTCP.EmailValidation Namespace > Tcp Class > Connect Method : Connect(String,Int32,String,Int32) Method

Connect to a host, specifying the local interface to use.

[Visual Basic]
<DescriptionAttribute("Connect to a server using a specific interface and port.")> Overloads Public Sub Connect( _    ByVal server As String, _    ByVal serverPort As Integer, _    ByVal client As String, _    ByVal clientPort As Integer _ )
[C#]
[DescriptionAttribute("Connect to a server using a specific interface and port.")] public void Connect(    string server,    int serverPort,    string client,    int clientPort );
[C++]
[DescriptionAttribute("Connect to a server using a specific interface and port.")] public: void Connect(    string* server,    int serverPort,    string* client,    int clientPort )
[C++/CLI]
[DescriptionAttribute("Connect to a server using a specific interface and port.")] public: void Connect(    String^ server,    int serverPort,    String^ client,    int clientPort )

Parameters

server
Remote hostname or address in dot notation.
serverPort
Remote port, a number between 1 and 65535, inclusive.
client
Optional local hostname or address in dot notation. Use "" as default.
clientPort
Optional local port, a number between 1 and 65535, inclusive. Use 0 as default.

Remarks

The Tcp.Connect method establishes a network connection between the specified local network interface/port and the device identified by remote network address/port. If no exception is thrown, the connection has succeeded and the Tcp.Connected property will return true after this method returns. Once the connection has been made, you can send/receive data to/from the server.

This method always blocks until the attempted connection succeeds or fails.

Example

The following example demonstrates connecting to a server while specifying a local interface to use.

[Visual Basic] 

' Connect to the server, specifying the local interface to use
Tcp1.Connect("atropos", 13, "192.168.0.83", 8888)

' Since connection was to DAYTIME port (13), simply receive the time
Dim seg As Segment = Tcp1.Receive()

Debug.WriteLine("Time reported by server: " + seg.ToString())

[C#] 


// Connect to the server, specifying the local interface to use
tcp1.Connect("atropos", 13, "192.168.0.83", 8888);

// Since connection was to DAYTIME port (13), simply receive the time
Segment seg = tcp1.Receive();

Debug.WriteLine(
"Time reported by server: " + seg.ToString());
                

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP, Windows Server 2003, Windows Vista

See Also

Tcp Class  | Tcp Members  | Overload List


Send comments on this topic.

Documentation version 1.0.3.0.

© 2008 Dart Communications.  All rights reserved.