필터 지우기
필터 지우기

tcpip simulink block as server?

조회 수: 3 (최근 30일)
Nina Buchanan
Nina Buchanan 2017년 6월 18일
댓글: Nina Buchanan 2017년 6월 22일
I have an app that sends/receives data over tcp with localhost, but only as a client. Thus, the following works:
raw_data= '1234567890qwertyuiop'; t=tcpip('127.0.0.1', 9876, 'NetworkRole', 'server'); fopen(t); fwrite(t, raw_data); fclose(t);
However, the simulink blocks in the instrument control toolbox will not work to send/receive data, perhaps because they are not configured to act as server. Is there a way to modify these blocks to make this work? Thanks.

채택된 답변

Vishal Neelagiri
Vishal Neelagiri 2017년 6월 22일
The TCP/IP Send and TCP/IP Receive blocks operate only in TCP/IP client mode (they need to connect to a TCP/IP server) and perform operations equivalent to FWRITE and, respectively, FREAD in MATLAB. Theses blocks do not support TCP/IP server functionality.
As a possible workaround, you can use a MATLAB function block to achieve the communication. See the attached example models, and MATLAB scripts

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Development Computer Setup에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by