Establishing a Telnet Connection with a Password
38 次查看(过去 30 天)
显示 更早的评论
Purpose: Establish a telnet connection to an external machine. The external machine usually uses windows command prompt to establish the telnet connection using the IP address and the port number. After establishing the connection the prompt asks for a password (password123). The password cannot be removed from the machine for the telnet connection. The machine commands are all text based (strings).
Objective: Run text based commands on the machine thru a telnet connection, using Matlab.
Currently: When the program is run, nothing happens. I dont think the password goes thru. The command does not run ('executeMacro F22').
Current Code:
%% Instrument Control Toolbox
% Interface-based communication
% tcpclient connection
clear all
clc
%enter the address to connect to and the port number
t = tcpclient("122.261.3.60", 3122, "ConnectTimeout",30);
read(t) %supposed to read all available data from the client t
response = writeread(t, 'Password123'); % write and read the respose.
write(t, 'executeMacro F22');
0 个评论
回答(1 个)
Sachin Lodhi
2024-1-11
Hello Javier,
Please refer to the provided MATLAB documentation link to learn how to set up a connection between a client and a server. - https://www.mathworks.com/help/instrument/communicate-between-a-tcpip-client-and-server-in-matlab.html
Also, refer the following related MATLAB Answers -
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!