Borrar filtros
Borrar filtros

Error in UDP when sending Bytes

2 visualizaciones (últimos 30 días)
PTP
PTP el 2 de Feb. de 2016
Editada: PTP el 2 de Feb. de 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

Respuestas (0)

Categorías

Más información sobre Just for fun en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by