Filter löschen
Filter löschen

Error in UDP when sending Bytes

2 Ansichten (letzte 30 Tage)
PTP
PTP am 2 Feb. 2016
Bearbeitet: PTP am 2 Feb. 2016
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

Antworten (0)

Kategorien

Mehr zu Just for fun finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by