Asynchronous TCP client read.

6 visualizaciones (últimos 30 días)
MichaU709
MichaU709 el 17 de Dic. de 2020
Editada: Jemima Pulipati el 20 de Dic. de 2020
Hello ,
Why I am reciving below error:
"First input must be a file name or a file identifier."
While I am trying to using TCP class like this:
t = tcpclient("127.0.0.1",5555);
fopen(t);

Respuestas (1)

Jemima Pulipati
Jemima Pulipati el 20 de Dic. de 2020
Editada: Jemima Pulipati el 20 de Dic. de 2020
Hello,
From my understanding, you want to read the data from the server using the fopen().
fopen() is used to open a file or to obtain any file information. It expects a filename or a file identifier as its input. Since here you are passing a tcp client properties object to the fopen(), it is throwing that error you mentioned.
A tcpclient properties object looks something like below:
t = tcpclient("www.mathworks.com",80)
t =
tcpclient with properties:
Address: 'www.mathworks.com'
Port: 80
NumBytesAvailable: 0
Show all properties, functions
So this object cannot be used along with fopen().
You may use read() by passing the tcp client properties object to read the data.
An example of it can be found in this documentation link:

Etiquetas

Productos


Versión

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by