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

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

Adding files for WARPLab release 05

File size: 726 bytes
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 repository browser.