source: ResearchApps/PHY/WARPLAB/WARPLab_v06_1/M_Code_Reference/warplab_pktSend.m

Last change on this file was 1311, checked in by mduarte, 15 years ago

Adding files for WARPLab release 05

File size: 670 bytes
Line 
1function replyPkt = warplab_pktSend(udpSock, pktData)
2replyPkt = 0;
3try
4    %Write the packet to the write buffer and then send
5    pnet(udpSock, 'write', int32(pktData));
6    pnet(udpSock, 'writepacket');
7   
8    %Wait to receive reply from the board
9    len = 0;
10    timeout = 0;
11    while (len <= 0),
12        len = pnet(udpSock, 'readpacket');
13        timeout = timeout + 1;
14        if (timeout == 10),
15            errordlg('No ACK received - Connection has timed out.', 'Timeout');
16            pnet('closeall');
17            returnStatus = 1;
18            return;
19        end
20    end
21
22    replyPkt = pnet(udpSock, 'read', len, 'uint32');
23end
24
Note: See TracBrowser for help on using the repository browser.