Sending/recieving data via UDP

6 ビュー (過去 30 日間)
Shane
Shane 2014 年 11 月 19 日
コメント済み: Biruntha Gnaneswaran 2015 年 10 月 25 日
I am trying to make a program listen for data coming via UDP, and do stuff. So I am working on a UDP listener. I am then running another instance of Matlab and trying to send data via UDP to test the listening.
However, I never get anything in the data stream. I am just trying to send the value 1 currently.
My Listener code:
U = udp('localhost', 4012);
fopen(U);
set(U,'Timeout',10);
continueListening = 1;
blah = 1;
while continueListening
dataStream = fread(U,1)
blah
if dataStream == 555;
continueListening = 0;
disp('Stoping acqusition');
end
blah = blah+1;
end
fclose(U);
And my writer code:
U = udp('localhost', 4012);
fopen(U);
fwrite(U, 1)
fclose(U);
  1 件のコメント
Biruntha Gnaneswaran
Biruntha Gnaneswaran 2015 年 10 月 25 日
I want to send data from pc to raspberry pi. here i use matlab to send data on pc. can i use python code to receive data in raspberry pi?

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeWeb Services についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by