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

Last change on this file was 1807, checked in by chunter, 12 years ago

renaming root

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