フィルターのクリア

Error in UDP when sending Bytes

2 ビュー (過去 30 日間)
PTP
PTP 2016 年 2 月 2 日
編集済み: PTP 2016 年 2 月 2 日
Good Morning Everyone,
I am trying to send Bytes from one node to another.I have tried all variations of fprintf , sprintf but get some or the other error all the time. Here is my Code :
udpa = udp('192.168.2.8',7090,'LocalPort',7091);
fopen(udpa)
TheTime = now;
dv = datevec(TheTime);
dv(6) = 0;
reconstructed_time = datenum(dv);
timediff = TheTime - reconstructed_time;
diff_secs = timediff * 24*60*60;
s = sprintf('Master node sent Sync Message at Time %s%09.6f', datestr(dv, 'yyyy-mm-dd HH:MM:'), diff_secs);
Bytes = uint8(s);
s1 = sprintf(udpa, Bytes) % error is in this line : too many output arguments%
fclose(udpa)
delete(udpa)
Post Script: I am already able to send messages and time to another node via fprintf but not able to get through Bytes somehow. Most of the times , i also witness an error of
Adress already in use Error UDP Socket fopen() . I would appreciate any help :)
Kind regards

回答 (0 件)

カテゴリ

Help Center および File ExchangeJust for fun についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by