Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

data lost over UDP in matlab

Status
Not open for further replies.

engr_najam

Full Member level 2
Joined
Aug 10, 2006
Messages
128
Helped
7
Reputation
14
Reaction score
1
Trophy points
1,298
Activity points
1,939
Hi;
I have a problem with using udp command in matlab.
from the sending end i send in data. on the receiving end i received the data with data (packets) lost.
Can any one please guide me where the problem is. ?

the size of my receiving buffer is 8192 Bytes and the data is send continuously.
 

My transmitter code is:

u1=udp('192.168.1.55', 9091,'LocalPort', 9090);
set(u1, 'OutputBufferSize', 8192)
set(u1, 'TimeOut', 10)
fopen(u1)
get(u1, 'Status')
while(1)
fwrite(u1, ubuffer(1, : ), 'double'); %ubuffer is of size 1x1024
end
fclose(u1)
delete(u1)

My receiver code is:

u=udp('192.168.1.166', 9090, 'LocalPort', 9091, 'InputBufferSize', 8192, 'TimeOut', 10);
fopen(u);
while(1)
[a,count]= fread(u, 1024, 'double');
end
fclose(u)
delete(u)

My problem is that as soon as i increase the number of elements transmitted past 64, i can only receive 64 elements at receiver. Like if i transmit 1x1024 element array, at receiver i get first 64 elements only. Like at this line of code at receiver:

[a,count]= fread(u, 1024, 'double');

i only get 'a' of size 64x1, although i should get 1024x1 size of 'a'. The value of count is also 64, it should be 1024.

To rectify this i have to use a loop and make a 2d array at receiver like 64x16 for 1024 element transmitted array. Also i get a warning "The specified amount of data was not returned in time" after reading every 64 elements. Is there any solution to receive all elements like 1024 in one go??? like i dont have to use loop just
[a,count]= fread(u, 1024, 'double');
and i get all the transmitted elements.

My second problem is that i cannot transmit complex numbers using UDP. I transmit 3 complex numbers and at receiver i only get real part of these complex numbers. Any ideas????
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top