Matlab : Telnet to remote machine not successful
Mostrar comentarios más antiguos
tCmd = tcpip("10.232.133.147", 5023);
fopen(tCmd);
fwrite(tCmd,':SOUR:POW:AMPL -63 DBM ' );
fclose(tCmd);
I also tried with tcpclient in place of tcpip , still telnet is unsuccesful to remote machine
4 comentarios
Walter Roberson
el 24 de Jun. de 2024
fwrite is not going to send any packet delimiter, no carriage return or line feed.
Siva Meduri
el 25 de Jun. de 2024
Siva Meduri
el 25 de Jun. de 2024
Editada: Walter Roberson
el 25 de Jun. de 2024
Walter Roberson
el 25 de Jun. de 2024
Possibly the other side needs \r\n ?
Respuestas (2)
Aneela
el 24 de Jul. de 2024
Hi Siva,
I am able to create a server which accepts TCP connections using the following code in MATLAB R2023b.
tCmd = tcpclient("127.0.0.1", 5023);
command = 'ls\n';
write(tCmd, uint8(command));
pause(1);
if tCmd.NumBytesAvailable > 0
response = read(tCmd, tCmd.NumBytesAvailable, "uint8");
disp(char(response'));
else
disp('No response received from the server.');
end
clear tCmd;
I have configured the server to respond with a “Hi” message, received a response saying “Hi” when the request is sent from MATLAB client.
I suggest you ensure that the server is handling the client requests appropriately.
Also, I recommend using “tcpclient” as “tcpip” will be deprecated in the future releases.
Andrei
el 30 de Ag. de 2024
0 votos
See answer in related post
Categorías
Más información sobre TCP/IP Communication en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!