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 CenterFile Exchange 中查找有关 Just for fun 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by