Sends command to TELNET server terminated by command terminator.

Namespace: Jscape.Telnet
Assembly: Jscape.Telnet (in Jscape.Telnet.dll) Version: 2.6.1.0

Syntax

C#
public string SendWait(
	string command,
	string prompt,
	bool regex,
	int timeout
)
Visual Basic
Public Function SendWait ( _
	command As String, _
	prompt As String, _
	regex As Boolean, _
	timeout As Integer _
) As String
Visual C++
public:
String^ SendWait(
	String^ command, 
	String^ prompt, 
	bool regex, 
	int timeout
)

Parameters

command
Type: System..::..String
The command to send.
prompt
Type: System..::..String
The prompt returned by the TELNET server.
regex
Type: System..::..Boolean
True if prompt is a regular expression, False otherwise.
timeout
Type: System..::..Int32
The maximum time in milliseconds task will wait until prompt is returned by TELNET server. The default timeout is 120 seconds.

Return Value

The response from the TELNET server.

Remarks

Waits for the specified timeout or until the prompt is returned by the TELNET server buffering response data. Refer to the Visual Studio .NET documentation for more information about creating reagular expressions.

Examples

To send a command to the TELNET server, pass in the command to send, and the prompt to wait for. The SendWait method automatically appends '\n' to the command.
CopySendWait
// Send command to TELNET server.
session.SendWait("passwd", "[Ee]nter new password:", true, 5000);

CopySendWait
' Send command to TELNET server.
session.SendWait("passwd", "[Ee]nter new password:", true, 5000)

See Also