From: mauro Gaggero on
Dear all,

I have to connect to a remote application via telnet (or netcat). So I use the command
> telnet ip port
from a command prompt. Later I send some commands via telnet to the remote application (the command made up by the string "I"). The application answers me with a sequence of bytes representing an image.

My problem is: how can I import such a sequence on matlab in real time so that I can see the image? I would like to be able to send the command I directly in Matlab and pass the results directly to matlab...

Any idea? Thanks in advance.

Mauro
From: Matt Dunham on
"mauro Gaggero" <mauro.gaggero(a)gmail.com> wrote in message <hlu5kq$t2n$1(a)fred.mathworks.com>...
> Dear all,
>
> I have to connect to a remote application via telnet (or netcat). So I use the command
> > telnet ip port
> from a command prompt. Later I send some commands via telnet to the remote application (the command made up by the string "I"). The application answers me with a sequence of bytes representing an image.
>
> My problem is: how can I import such a sequence on matlab in real time so that I can see the image? I would like to be able to send the command I directly in Matlab and pass the results directly to matlab...
>
> Any idea? Thanks in advance.
>
> Mauro

You should be able to do this with the system command,

[status, result] = system('telnet ip host').

You will need to send the command at connection time. If your telnet program doesn't support this, you could try using an ssh client, (like putty) and connect over the telnet protocol. I think the result will be returned as a string, which you may need to parse using e.g str2num.