PowerTCP Mail for .NET
BeginConnect(String,Int32,String,Int32,Int32,Object) Method
See Also  Send comments on this topic.
Dart.PowerTCP.Mail Namespace > Tcp Class > BeginConnect Method : BeginConnect(String,Int32,String,Int32,Int32,Object) Method




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.
clientPortMin
The minimum client port number to use as a local interface.
clientPortMax
The maximim client port number to use as a local interface.
state
User state information.
Connect to a server asynchronously, specifying the local interface and a range of local ports to use. The Tcp.EndConnect event is raised when completed.

Syntax

Visual Basic (Declaration) 
<DescriptionAttribute("Connect to a server asynchronously. The EndConnect event is raised when completed.")>
Public Overloads Overridable Function BeginConnect( _
   ByVal server As String, _
   ByVal serverPort As Integer, _
   ByVal client As String, _
   ByVal clientPortMin As Integer, _
   ByVal clientPortMax As Integer, _
   ByVal state As Object _
) As IAsyncResult
Visual Basic (Usage)Copy Code
Dim instance As Tcp
Dim server As String
Dim serverPort As Integer
Dim client As String
Dim clientPortMin As Integer
Dim clientPortMax As Integer
Dim state As Object
Dim value As IAsyncResult
 
value = instance.BeginConnect(server, serverPort, client, clientPortMin, clientPortMax, state)
C# 
[DescriptionAttribute("Connect to a server asynchronously. The EndConnect event is raised when completed.")]
public virtual IAsyncResult BeginConnect( 
   string server,
   int serverPort,
   string client,
   int clientPortMin,
   int clientPortMax,
   object state
)
Managed Extensions for C++ 
[DescriptionAttribute("Connect to a server asynchronously. The EndConnect event is raised when completed.")]
public: virtual IAsyncResult* BeginConnect( 
   string* server,
   int serverPort,
   string* client,
   int clientPortMin,
   int clientPortMax,
   Object* state
) 
C++/CLI 
[DescriptionAttribute("Connect to a server asynchronously. The EndConnect event is raised when completed.")]
public:
virtual IAsyncResult^ BeginConnect( 
   String^ server,
   int serverPort,
   String^ client,
   int clientPortMin,
   int clientPortMax,
   Object^ state
) 

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.
clientPortMin
The minimum client port number to use as a local interface.
clientPortMax
The maximim client port number to use as a local interface.
state
User state information.

Return Value

An IAsyncResult that represents the asynchronous operation, which could still be pending.

Exceptions

ExceptionDescription
System.InvalidOperationExceptionBeginXXX method used without providing an EndXXX event handler.

Remarks

Use this method if you wish to connect to a host transparently with minimal application impact, as execution occurs on another thread. This method begins to asynchronously connect to the server. Upon completion (on both success and failure) the Tcp.EndConnect event is raised. An EventArgs object is passed into this event, containing information about the event. If the connection succeeds, the ConnectedChanged event is raised. Once the connection has been made, you can send and receive data from the remote device.

If you are using the Tcp component as a reference, you must "wire up" the event yourself. This involves creating a method as the event handler that implements the EventHandler delegate.

For more information on implementing and handling events using PowerTCP.NET, see the topic, Using Events In PowerTCP.

To connect synchronously, use the Tcp.Connect method.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

Documentation Version 3.2
© 2010 Dart Communications. All Rights Reserved.