Parameters
- callback
- The delegate to call when the asynchronous invoke is complete. If callback is a null reference (Nothing in Visual Basic), the delegate is not called.
- stateObject
- State information that is passed on to the delegate.
BeginOpen method enables you to open a connection to server without having current thread blocked. In other words, your program can continue execution while the connection is establishing so you do not have to wait for it.
To start opening a connection, you have to call BeginOpen method, which in turn invokes appropriate actions in another thread. Return value of this method must be assigned to System.IAsyncResult object. After executing this method program flow continues.
When you are ready to use the connection, call EndOpen. If at the moment you call this method the negotiation process has not yet been finished, application stops and waits till the function returns which means that the connection is open.
Refer to "Asynchronous Query Execution" article for detailed information.