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