Line | |
---|
1 | function socketHandles = warplab_initNets(SyncIPAddr, NodeIPAddrs, NodeUDPPorts) |
---|
2 | warplab_defines |
---|
3 | |
---|
4 | %Prepare the magic SYNC socket |
---|
5 | thisSock = pnet('udpsocket', SyncPort); |
---|
6 | pnet(thisSock, 'setreadtimeout', 1); |
---|
7 | pnet(thisSock, 'udpconnect', SyncIPAddr, SyncPort); |
---|
8 | %SYNC port should be bigger! |
---|
9 | |
---|
10 | socketHandles = [thisSock]; |
---|
11 | |
---|
12 | for 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]; |
---|
24 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.