root/ResearchApps/PHY/WARPLAB/WARPLAB_SISO/M_code/warplab_initNets.m

Revision 696, 0.7 kB (checked in by MelissaDuarte, 10 months ago)

minor changes

Line 
1function socketHandles = warplab_initNets(SyncIPAddr, NodeIPAddrs, NodeUDPPorts)
2
3%Prepare the magic SYNC socket
4thisSock = pnet('udpsocket', 10000);
5pnet(thisSock, 'setreadtimeout', 1);
6pnet(thisSock, 'udpconnect', SyncIPAddr, 10000);
7%SYNC port should be bigger!
8
9socketHandles = [thisSock];
10
11for n = 1:length(NodeIPAddrs)
12
13        %UDP Connections to individual nodes
14        thisSock = pnet('udpsocket', NodeUDPPorts(n));
15        if (thisSock == -1),
16                errordlg('Could not establish UDP connection.', 'Error');
17                pnet('closeall');
18                delete(hObject);
19        end
20        pnet(thisSock, 'udpconnect', warplab_int2IP(NodeIPAddrs(n)), NodeUDPPorts(n));
21        pnet(thisSock, 'setreadtimeout', 1);
22        socketHandles = [socketHandles thisSock];
23end
Note: See TracBrowser for help on using the browser.