Effacer les filtres
Effacer les filtres

Error in UDP when sending Bytes

2 vues (au cours des 30 derniers jours)
PTP
PTP le 2 Fév 2016
Modifié(e) : PTP le 2 Fév 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

Réponses (0)

Catégories

En savoir plus sur Just for fun dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by