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




prompt
Data is read until this string is found.
Reads data from the stream until the specified string is found.

Syntax

Visual Basic (Declaration) 
Public Overloads Function WaitFor( _
   ByVal prompt As String _
) As String
Visual Basic (Usage)Copy Code
Dim instance As Tcp
Dim prompt As String
Dim value As String
 
value = instance.WaitFor(prompt)
C# 
public string WaitFor( 
   string prompt
)
Managed Extensions for C++ 
public: string* WaitFor( 
   string* prompt
) 
C++/CLI 
public:
String^ WaitFor( 
   String^ prompt
) 

Parameters

prompt
Data is read until this string is found.

Return Value

A string containing all data read from the stream.

Exceptions

ExceptionDescription
System.Net.Sockets.SocketExceptionprompt was not found within the specified period of time.
System.InvalidOperationExceptionTcp.ReceiveTimeout is 0.

Remarks

This method reads from the data stream until the specified string is found or the method times out. Often, it is useful when communicating with a server to be able to read data until a token is found. For example, during a login operation the server may send a string "login:". You could use WaitFor to keep reading until you find "login:", then issue your login command.

This method will block for the amount of time specified in Tcp.ReceiveTimeout. If Tcp.ReceiveTimeout is 0, this method will throw a System.InvalidOperationException. If prompt is not found within the time specified by Tcp.ReceiveTimeout, a System.SocketException is thrown (with the timeout ErrorCode of 10060).

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

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