Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
feb400cf
Commit
feb400cf
authored
Jun 19, 2021
by
Pavel Vainerman
Committed by
Pavel Vainerman
Jun 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[unet-multicast]: config refactoring
parent
f34a0dfa
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
149 additions
and
259 deletions
+149
-259
MulticastTransport.cc
extensions/UNetUDP/MulticastTransport.cc
+75
-102
MulticastTransport.h
extensions/UNetUDP/MulticastTransport.h
+3
-2
UNetExchange.cc
extensions/UNetUDP/UNetExchange.cc
+14
-66
UNetExchange.h
extensions/UNetUDP/UNetExchange.h
+21
-39
test_unetmulticast.cc
extensions/UNetUDP/tests/test_unetmulticast.cc
+12
-12
test_unetudp_multicast.cc
extensions/UNetUDP/tests/test_unetudp_multicast.cc
+4
-4
unetudp-test-configure.xml
extensions/UNetUDP/tests/unetudp-test-configure.xml
+13
-34
unet-multicast-tester.cc
extensions/UNetUDP/unet-multicast-tester.cc
+7
-0
No files found.
extensions/UNetUDP/MulticastTransport.cc
View file @
feb400cf
...
@@ -45,15 +45,17 @@ xmlNode* MulticastReceiveTransport::getReceiveListNode( UniXML::iterator root )
...
@@ -45,15 +45,17 @@ xmlNode* MulticastReceiveTransport::getReceiveListNode( UniXML::iterator root )
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
/*
/*
* <item id="3000" unet_port="2048" unet_multicast_ip="192.168.0.255" unet_port2="2048" unet_multicast_ip2="192.169.0.255">
* <item id="3000"
<multicast>
* unet_multicast_port="2048"
<receive>
* unet_multicast_ip="224.0.0.1"
<group addr="224.0.0.1" addr2="224.0.0.1"/>
* unet_multicast_iface="192.168.1.1"
</receive>
* unet_multicast_port2="2049"
</multicast>
* unet_multicast_ip2="225.0.0.1"
</item>
* unet_multicast_iface2="192.169.1.1"
* >
* </item>
*/
*/
std
::
unique_ptr
<
MulticastReceiveTransport
>
MulticastReceiveTransport
::
createFromXml
(
UniXML
::
iterator
it
,
const
std
::
string
&
defaultIP
,
int
numChan
,
const
std
::
string
&
defIface
,
const
std
::
string
&
sectio
n
)
std
::
unique_ptr
<
MulticastReceiveTransport
>
MulticastReceiveTransport
::
createFromXml
(
UniXML
::
iterator
it
,
int
numCha
n
)
{
{
ostringstream
fieldIp
;
ostringstream
fieldIp
;
fieldIp
<<
"unet_multicast_ip"
;
fieldIp
<<
"unet_multicast_ip"
;
...
@@ -61,7 +63,7 @@ std::unique_ptr<MulticastReceiveTransport> MulticastReceiveTransport::createFrom
...
@@ -61,7 +63,7 @@ std::unique_ptr<MulticastReceiveTransport> MulticastReceiveTransport::createFrom
if
(
numChan
>
0
)
if
(
numChan
>
0
)
fieldIp
<<
numChan
;
fieldIp
<<
numChan
;
const
string
h
=
it
.
getProp
2
(
fieldIp
.
str
(),
defaultIP
);
const
string
h
=
it
.
getProp
(
fieldIp
.
str
()
);
if
(
h
.
empty
()
)
if
(
h
.
empty
()
)
{
{
...
@@ -78,41 +80,25 @@ std::unique_ptr<MulticastReceiveTransport> MulticastReceiveTransport::createFrom
...
@@ -78,41 +80,25 @@ std::unique_ptr<MulticastReceiveTransport> MulticastReceiveTransport::createFrom
int
p
=
it
.
getPIntProp
(
fieldPort
.
str
(),
it
.
getIntProp
(
"id"
));
int
p
=
it
.
getPIntProp
(
fieldPort
.
str
(),
it
.
getIntProp
(
"id"
));
if
(
!
it
.
find
(
"multicast"
)
)
ostringstream
ifaceField
;
throw
SystemError
(
"(MulticastReceiveTransport): not found <multicast> node"
);
ifaceField
<<
"unet_multicast_iface"
;
if
(
!
it
.
goChildren
()
)
throw
SystemError
(
"(MulticastReceiveTransport): empty <multicast> node"
);
if
(
!
it
.
find
(
section
)
)
throw
SystemError
(
"(MulticastReceiveTransport): not found <"
+
section
+
"> in <multicast>"
);
if
(
!
it
.
goChildren
()
)
throw
SystemError
(
"(MulticastReceiveTransport): empty <"
+
section
+
"> groups"
);
std
::
vector
<
Poco
::
Net
::
IPAddress
>
groups
;
ostringstream
fieldAddr
;
fieldAddr
<<
"addr"
;
if
(
numChan
>
0
)
if
(
numChan
>
0
)
fieldAddr
<<
numChan
;
ifaceField
<<
numChan
;
for
(
;
it
;
it
++
)
const
string
iface
=
it
.
getProp
(
ifaceField
.
str
());
{
Poco
::
Net
::
IPAddress
a
(
it
.
getProp
(
fieldAddr
.
str
()),
Poco
::
Net
::
IPAddress
::
IPv4
);
if
(
!
a
.
isMulticast
()
)
Poco
::
Net
::
IPAddress
a
(
h
);
if
(
!
a
.
isMulticast
()
&&
!
a
.
isWildcard
()
)
{
{
ostringstream
err
;
ostringstream
err
;
err
<<
"(MulticastReceiveTransport): "
<<
it
.
getProp
(
fieldAddr
.
str
())
<<
" is not multicast address
"
;
err
<<
"(MulticastReceiveTransport): "
<<
h
<<
" is not multicast address or 0.0.0.0
"
;
throw
SystemError
(
err
.
str
());
throw
SystemError
(
err
.
str
());
}
}
groups
.
push_back
(
a
);
std
::
vector
<
Poco
::
Net
::
IPAddress
>
groups
{
a
};
}
return
unisetstd
::
make_unique
<
MulticastReceiveTransport
>
(
h
,
p
,
std
::
move
(
groups
),
iface
);
return
unisetstd
::
make_unique
<
MulticastReceiveTransport
>
(
h
,
p
,
std
::
move
(
groups
),
defIface
);
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
MulticastReceiveTransport
::
MulticastReceiveTransport
(
const
std
::
string
&
_bind
,
int
_port
,
MulticastReceiveTransport
::
MulticastReceiveTransport
(
const
std
::
string
&
_bind
,
int
_port
,
...
@@ -194,28 +180,35 @@ bool MulticastReceiveTransport::createConnection( bool throwEx, timeout_t readTi
...
@@ -194,28 +180,35 @@ bool MulticastReceiveTransport::createConnection( bool throwEx, timeout_t readTi
}
}
catch
(
const
Poco
::
Net
::
InterfaceNotFoundException
&
ex
)
catch
(
const
Poco
::
Net
::
InterfaceNotFoundException
&
ex
)
{
{
if
(
throwEx
)
{
ostringstream
err
;
ostringstream
err
;
err
<<
"(MulticastReceiveTransport): Not found interface for address "
<<
ifaceaddr
;
err
<<
"(MulticastReceiveTransport): Not found interface for address "
<<
ifaceaddr
;
throw
uniset
::
SystemError
(
err
.
str
());
throw
uniset
::
SystemError
(
err
.
str
());
}
}
}
catch
(
const
std
::
exception
&
e
)
catch
(
const
std
::
exception
&
e
)
{
{
udp
=
nullptr
;
udp
=
nullptr
;
ostringstream
s
;
s
<<
host
<<
":"
<<
port
<<
"(createConnection): "
<<
e
.
what
();
if
(
throwEx
)
if
(
throwEx
)
{
ostringstream
s
;
s
<<
host
<<
":"
<<
port
<<
"(createConnection): "
<<
e
.
what
();
throw
uniset
::
SystemError
(
s
.
str
());
throw
uniset
::
SystemError
(
s
.
str
());
}
}
}
catch
(
...
)
catch
(
...
)
{
{
udp
=
nullptr
;
udp
=
nullptr
;
ostringstream
s
;
s
<<
host
<<
":"
<<
port
<<
"(createConnection): catch..."
;
if
(
throwEx
)
if
(
throwEx
)
{
ostringstream
s
;
s
<<
host
<<
":"
<<
port
<<
"(createConnection): catch..."
;
throw
uniset
::
SystemError
(
s
.
str
());
throw
uniset
::
SystemError
(
s
.
str
());
}
}
}
return
(
udp
!=
nullptr
);
return
(
udp
!=
nullptr
);
}
}
...
@@ -245,21 +238,21 @@ void MulticastReceiveTransport::setLoopBack( bool state )
...
@@ -245,21 +238,21 @@ void MulticastReceiveTransport::setLoopBack( bool state )
if
(
udp
)
if
(
udp
)
udp
->
setLoopback
(
state
);
udp
->
setLoopback
(
state
);
}
}
// -------------------------------------------------------------------------
std
::
string
MulticastReceiveTransport
::
iface
()
const
{
return
ifaceaddr
;
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
/*
/*
* <item id="3000" unet_port="2048" unet_multicast_ip="192.168.0.255" unet_port2="2048" unet_multicast_ip2="192.169.0.255">
* <item id="3000"
<multicast>
* unet_multicast_port="2048"
<receive>
* unet_multicast_ip="224.0.0.1"
<group addr="224.0.0.1" addr2="224.0.0.1"/>
* unet_multicast_port2="2049"
</receive>
* unet_multicast_ip2="225.0.0.1"
<send>
* unet_multicast_ttl="3"/>
<group addr="224.0.0.1"/>
</send>
</multicast>
</item>
*/
*/
std
::
unique_ptr
<
MulticastSendTransport
>
MulticastSendTransport
::
createFromXml
(
UniXML
::
iterator
it
,
const
std
::
string
&
defaultIP
,
int
numChan
)
std
::
unique_ptr
<
MulticastSendTransport
>
MulticastSendTransport
::
createFromXml
(
UniXML
::
iterator
it
,
int
numChan
)
{
{
ostringstream
fieldIp
;
ostringstream
fieldIp
;
fieldIp
<<
"unet_multicast_ip"
;
fieldIp
<<
"unet_multicast_ip"
;
...
@@ -267,15 +260,24 @@ std::unique_ptr<MulticastSendTransport> MulticastSendTransport::createFromXml( U
...
@@ -267,15 +260,24 @@ std::unique_ptr<MulticastSendTransport> MulticastSendTransport::createFromXml( U
if
(
numChan
>
0
)
if
(
numChan
>
0
)
fieldIp
<<
numChan
;
fieldIp
<<
numChan
;
const
string
h
=
it
.
getProp
2
(
fieldIp
.
str
(),
defaultIP
);
const
string
h
=
it
.
getProp
(
fieldIp
.
str
()
);
if
(
h
.
empty
()
)
if
(
h
.
empty
()
)
{
{
ostringstream
err
;
ostringstream
err
;
err
<<
"(MulticastSendTransport): Un
known multicast IP
for "
<<
it
.
getProp
(
"name"
);
err
<<
"(MulticastSendTransport): Un
defined "
<<
fieldIp
.
str
()
<<
"
for "
<<
it
.
getProp
(
"name"
);
throw
uniset
::
SystemError
(
err
.
str
());
throw
uniset
::
SystemError
(
err
.
str
());
}
}
Poco
::
Net
::
IPAddress
a
(
h
);
if
(
!
a
.
isMulticast
()
)
{
ostringstream
err
;
err
<<
"(MulticastSendTransport): "
<<
h
<<
" is not multicast"
;
throw
SystemError
(
err
.
str
());
}
ostringstream
fieldPort
;
ostringstream
fieldPort
;
fieldPort
<<
"unet_multicast_port"
;
fieldPort
<<
"unet_multicast_port"
;
...
@@ -284,56 +286,23 @@ std::unique_ptr<MulticastSendTransport> MulticastSendTransport::createFromXml( U
...
@@ -284,56 +286,23 @@ std::unique_ptr<MulticastSendTransport> MulticastSendTransport::createFromXml( U
int
p
=
it
.
getPIntProp
(
fieldPort
.
str
(),
it
.
getIntProp
(
"id"
));
int
p
=
it
.
getPIntProp
(
fieldPort
.
str
(),
it
.
getIntProp
(
"id"
));
if
(
!
it
.
find
(
"multicast"
)
)
if
(
p
<=
0
)
throw
SystemError
(
"(MulticastSendTransport): not found <multicast> node"
);
if
(
!
it
.
goChildren
()
)
throw
SystemError
(
"(MulticastSendTransport): empty <multicast> node"
);
if
(
!
it
.
find
(
"send"
)
)
throw
SystemError
(
"(MulticastSendTransport): not found <send> node"
);
int
ttl
=
it
.
getPIntProp
(
"ttl"
,
1
);
if
(
!
it
.
goChildren
()
)
throw
SystemError
(
"(MulticastSendTransport): empty <send> groups"
);
ostringstream
fieldAddr
;
fieldAddr
<<
"addr"
;
if
(
numChan
>
0
)
fieldAddr
<<
numChan
;
ostringstream
fieldGroupPort
;
fieldGroupPort
<<
"port"
;
if
(
numChan
>
0
)
fieldGroupPort
<<
numChan
;
string
groupAddr
;
int
groupPort
=
p
;
int
gnum
=
0
;
for
(
;
it
;
it
++
)
{
{
groupAddr
=
it
.
getProp
(
fieldAddr
.
str
());
ostringstream
err
;
err
<<
"(MulticastSendTransport): Undefined "
<<
fieldPort
.
str
()
<<
" for "
<<
it
.
getProp
(
"name"
);
if
(
groupAddr
.
empty
()
)
throw
SystemError
(
err
.
str
());
throw
SystemError
(
"(MulticastSendTransport): unknown group address for send"
);
}
groupPort
=
it
.
getPIntProp
(
fieldGroupPort
.
str
(),
p
);
if
(
groupPort
<=
0
)
ostringstream
ipField
;
throw
SystemError
(
"(MulticastSendTransport): unknown group port for send"
)
;
ipField
<<
"unet_multicast_sender_ip"
;
gnum
++
;
if
(
numChan
>
0
)
}
ipField
<<
numChan
;
if
(
gnum
>
1
)
const
string
ip
=
it
.
getProp2
(
ipField
.
str
(),
"0.0.0.0"
);
throw
SystemError
(
"(MulticastSendTransport): size list <groups> "
+
std
::
to_string
(
gnum
)
+
" > 1. Currently only ONE multicast group is supported to send"
);
return
unisetstd
::
make_unique
<
MulticastSendTransport
>
(
h
,
p
,
groupAddr
,
groupPort
,
ttl
);
int
ttl
=
it
.
getPIntProp
(
"unet_multicast_ttl"
,
1
);
return
unisetstd
::
make_unique
<
MulticastSendTransport
>
(
ip
,
p
,
h
,
p
,
ttl
);
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
MulticastSendTransport
::
MulticastSendTransport
(
const
std
::
string
&
_host
,
int
_port
,
const
std
::
string
&
grHost
,
int
grPort
,
int
_ttl
)
:
MulticastSendTransport
::
MulticastSendTransport
(
const
std
::
string
&
_host
,
int
_port
,
const
std
::
string
&
grHost
,
int
grPort
,
int
_ttl
)
:
...
@@ -391,21 +360,25 @@ bool MulticastSendTransport::createConnection( bool throwEx, timeout_t sendTimeo
...
@@ -391,21 +360,25 @@ bool MulticastSendTransport::createConnection( bool throwEx, timeout_t sendTimeo
catch
(
const
std
::
exception
&
e
)
catch
(
const
std
::
exception
&
e
)
{
{
udp
=
nullptr
;
udp
=
nullptr
;
ostringstream
s
;
s
<<
sockAddr
.
toString
()
<<
"(createConnection): "
<<
e
.
what
();
if
(
throwEx
)
if
(
throwEx
)
{
ostringstream
s
;
s
<<
sockAddr
.
toString
()
<<
"(createConnection): "
<<
e
.
what
();
throw
uniset
::
SystemError
(
s
.
str
());
throw
uniset
::
SystemError
(
s
.
str
());
}
}
}
catch
(
...
)
catch
(
...
)
{
{
udp
=
nullptr
;
udp
=
nullptr
;
ostringstream
s
;
s
<<
sockAddr
.
toString
()
<<
"(createConnection): catch..."
;
if
(
throwEx
)
if
(
throwEx
)
{
ostringstream
s
;
s
<<
sockAddr
.
toString
()
<<
"(createConnection): catch..."
;
throw
uniset
::
SystemError
(
s
.
str
());
throw
uniset
::
SystemError
(
s
.
str
());
}
}
}
return
(
udp
!=
nullptr
);
return
(
udp
!=
nullptr
);
}
}
...
...
extensions/UNetUDP/MulticastTransport.h
View file @
feb400cf
...
@@ -31,7 +31,7 @@ namespace uniset
...
@@ -31,7 +31,7 @@ namespace uniset
{
{
public
:
public
:
static
std
::
unique_ptr
<
MulticastReceiveTransport
>
createFromXml
(
UniXML
::
iterator
it
,
const
std
::
string
&
defaultIP
,
int
numChan
,
const
std
::
string
&
defIface
=
""
,
const
std
::
string
&
section
=
"receive"
);
static
std
::
unique_ptr
<
MulticastReceiveTransport
>
createFromXml
(
UniXML
::
iterator
it
,
int
numChan
);
static
xmlNode
*
getReceiveListNode
(
UniXML
::
iterator
root
);
static
xmlNode
*
getReceiveListNode
(
UniXML
::
iterator
root
);
MulticastReceiveTransport
(
const
std
::
string
&
bind
,
int
port
,
const
std
::
vector
<
Poco
::
Net
::
IPAddress
>&
joinGroups
,
const
std
::
string
&
iface
=
""
);
MulticastReceiveTransport
(
const
std
::
string
&
bind
,
int
port
,
const
std
::
vector
<
Poco
::
Net
::
IPAddress
>&
joinGroups
,
const
std
::
string
&
iface
=
""
);
...
@@ -49,6 +49,7 @@ namespace uniset
...
@@ -49,6 +49,7 @@ namespace uniset
bool
isReadyForReceive
(
timeout_t
tout
)
override
;
bool
isReadyForReceive
(
timeout_t
tout
)
override
;
virtual
ssize_t
receive
(
void
*
r_buf
,
size_t
sz
)
override
;
virtual
ssize_t
receive
(
void
*
r_buf
,
size_t
sz
)
override
;
std
::
string
iface
()
const
;
protected
:
protected
:
std
::
unique_ptr
<
MulticastSocketU
>
udp
;
std
::
unique_ptr
<
MulticastSocketU
>
udp
;
...
@@ -63,7 +64,7 @@ namespace uniset
...
@@ -63,7 +64,7 @@ namespace uniset
{
{
public
:
public
:
static
std
::
unique_ptr
<
MulticastSendTransport
>
createFromXml
(
UniXML
::
iterator
it
,
const
std
::
string
&
defaultIP
,
int
numChan
);
static
std
::
unique_ptr
<
MulticastSendTransport
>
createFromXml
(
UniXML
::
iterator
it
,
int
numChan
);
MulticastSendTransport
(
const
std
::
string
&
sockHost
,
int
sockPort
,
const
std
::
string
&
groupHost
,
int
groupPort
,
int
ttl
=
1
);
MulticastSendTransport
(
const
std
::
string
&
sockHost
,
int
sockPort
,
const
std
::
string
&
groupHost
,
int
groupPort
,
int
ttl
=
1
);
virtual
~
MulticastSendTransport
();
virtual
~
MulticastSendTransport
();
...
...
extensions/UNetUDP/UNetExchange.cc
View file @
feb400cf
...
@@ -1095,19 +1095,11 @@ void UNetExchange::initMulticastTransport( UniXML::iterator n_it,
...
@@ -1095,19 +1095,11 @@ void UNetExchange::initMulticastTransport( UniXML::iterator n_it,
const
std
::
string
&
n_fvalue
,
const
std
::
string
&
n_fvalue
,
const
std
::
string
&
prefix
)
const
std
::
string
&
prefix
)
{
{
auto
conf
=
uniset_conf
();
auto
conf
=
uniset_conf
();
const
string
default_ip
=
n_it
.
getProp
(
"unet_multicast_ip"
);
const
string
default_ip2
=
n_it
.
getProp
(
"unet_multicast_ip2"
);
const
string
default_iface1
=
n_it
.
getProp
(
"unet_multicast_iface1"
);
const
string
default_iface2
=
n_it
.
getProp
(
"unet_multicast_iface2"
);
if
(
!
n_it
.
goChildren
()
)
if
(
!
n_it
.
goChildren
()
)
throw
uniset
::
SystemError
(
"(UNetExchange): Items not found for <nodes>"
);
throw
uniset
::
SystemError
(
"(UNetExchange): Items not found for <nodes>"
);
xmlNode
*
selfNode
=
nullptr
;
// init senders
// init senders
for
(
;
n_it
.
getCurrent
();
n_it
.
goNext
()
)
for
(
;
n_it
.
getCurrent
();
n_it
.
goNext
()
)
{
{
...
@@ -1123,9 +1115,11 @@ void UNetExchange::initMulticastTransport( UniXML::iterator n_it,
...
@@ -1123,9 +1115,11 @@ void UNetExchange::initMulticastTransport( UniXML::iterator n_it,
string
n
=
n_it
.
getProp
(
"name"
);
string
n
=
n_it
.
getProp
(
"name"
);
if
(
n
=
=
conf
->
getLocalNodeName
()
)
if
(
n
!
=
conf
->
getLocalNodeName
()
)
{
{
selfNode
=
n_it
.
getCurrent
();
initMulticastReceiverForNode
(
n_it
,
prefix
);
continue
;
}
if
(
no_sender
)
if
(
no_sender
)
{
{
...
@@ -1133,9 +1127,10 @@ void UNetExchange::initMulticastTransport( UniXML::iterator n_it,
...
@@ -1133,9 +1127,10 @@ void UNetExchange::initMulticastTransport( UniXML::iterator n_it,
break
;
break
;
}
}
// INIT SENDER
unetinfo
<<
myname
<<
"(init): "
<<
n_it
.
getProp
(
"name"
)
<<
" init sender.."
<<
endl
;
unetinfo
<<
myname
<<
"(init): "
<<
n_it
.
getProp
(
"name"
)
<<
" init sender.."
<<
endl
;
auto
s1
=
MulticastSendTransport
::
createFromXml
(
n_it
,
default_ip
,
0
);
auto
s1
=
MulticastSendTransport
::
createFromXml
(
n_it
,
0
);
unetinfo
<<
myname
<<
"(init): "
<<
n_it
.
getProp
(
"name"
)
<<
" send (channel1) to multicast group: "
<<
s1
->
getGroupAddress
().
toString
()
<<
endl
;
unetinfo
<<
myname
<<
"(init): "
<<
n_it
.
getProp
(
"name"
)
<<
" send (channel1) to multicast group: "
<<
s1
->
getGroupAddress
().
toString
()
<<
endl
;
sender
=
make_shared
<
UNetSender
>
(
std
::
move
(
s1
),
shm
,
false
,
s_field
,
s_fvalue
,
"unet"
,
prefix
);
sender
=
make_shared
<
UNetSender
>
(
std
::
move
(
s1
),
shm
,
false
,
s_field
,
s_fvalue
,
"unet"
,
prefix
);
...
@@ -1145,9 +1140,9 @@ void UNetExchange::initMulticastTransport( UniXML::iterator n_it,
...
@@ -1145,9 +1140,9 @@ void UNetExchange::initMulticastTransport( UniXML::iterator n_it,
{
{
sender2
=
nullptr
;
sender2
=
nullptr
;
if
(
n_it
.
getProp
(
"unet_multicast_ip2"
).
empty
()
||
!
default_ip2
.
empty
()
)
if
(
n_it
.
getProp
(
"unet_multicast_ip2"
)
.
empty
()
)
{
{
auto
s2
=
MulticastSendTransport
::
createFromXml
(
n_it
,
default_ip2
,
2
);
auto
s2
=
MulticastSendTransport
::
createFromXml
(
n_it
,
2
);
if
(
s2
)
if
(
s2
)
unetinfo
<<
myname
<<
"(init): "
<<
n_it
.
getProp
(
"name"
)
<<
" send (channel2) to multicast group: "
<<
s2
->
getGroupAddress
().
toString
()
<<
endl
;
unetinfo
<<
myname
<<
"(init): "
<<
n_it
.
getProp
(
"name"
)
<<
" send (channel2) to multicast group: "
<<
s2
->
getGroupAddress
().
toString
()
<<
endl
;
...
@@ -1167,62 +1162,15 @@ void UNetExchange::initMulticastTransport( UniXML::iterator n_it,
...
@@ -1167,62 +1162,15 @@ void UNetExchange::initMulticastTransport( UniXML::iterator n_it,
sender2
=
nullptr
;
sender2
=
nullptr
;
unetcrit
<<
myname
<<
"(init): IGNORE! channel2 create error: "
<<
ex
.
what
()
<<
endl
;
unetcrit
<<
myname
<<
"(init): IGNORE! channel2 create error: "
<<
ex
.
what
()
<<
endl
;
}
}
break
;
}
}
// INIT RECEIVERS
if
(
selfNode
==
nullptr
)
{
unetwarn
<<
myname
<<
"(init): IGNORE! RECEIVE DISABLED.."
<<
endl
;
return
;
}
UniXML
::
iterator
it
(
selfNode
);
if
(
!
it
.
getIntProp
(
"unet_multicast_receive_from_all_nodes"
)
)
{
initMulticastReceiverForNode
(
n_it
,
default_ip
,
default_ip2
,
default_iface1
,
default_iface2
,
"receive"
,
prefix
);
return
;
}
unetwarn
<<
myname
<<
"(init): init multicast group from nodes.."
<<
endl
;
// init receivers (by nodes)
for
(
;
n_it
.
getCurrent
();
n_it
.
goNext
()
)
{
if
(
n_it
.
getIntProp
(
"unet_ignore"
)
)
{
unetinfo
<<
myname
<<
"(init): "
<<
n_it
.
getProp
(
"name"
)
<<
" unet_ignore.."
<<
endl
;
continue
;
}
// проверяем фильтры для подсетей
if
(
!
uniset
::
check_filter
(
n_it
,
n_field
,
n_fvalue
)
)
continue
;
string
n
=
n_it
.
getProp
(
"name"
);
if
(
n
==
conf
->
getLocalNodeName
()
)
continue
;
initMulticastReceiverForNode
(
n_it
,
default_ip
,
default_ip2
,
default_iface1
,
default_iface2
,
"send"
,
prefix
);
}
}
}
}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
void
UNetExchange
::
initMulticastReceiverForNode
(
UniXML
::
iterator
n_it
,
void
UNetExchange
::
initMulticastReceiverForNode
(
UniXML
::
iterator
n_it
,
const
std
::
string
&
prefix
)
const
std
::
string
&
default_ip
,
const
std
::
string
&
default_ip2
,
const
std
::
string
&
default_iface1
,
const
std
::
string
&
default_iface2
,
const
std
::
string
&
section
,
const
std
::
string
&
prefix
)
{
{
auto
conf
=
uniset_conf
();
auto
conf
=
uniset_conf
();
unetinfo
<<
myname
<<
"(init): "
<<
n_it
.
getProp
(
"name"
)
<<
" init receivers:"
<<
endl
;
unetinfo
<<
myname
<<
"(init): "
<<
n_it
.
getProp
(
"name"
)
<<
" init receivers:"
<<
endl
;
auto
transport1
=
MulticastReceiveTransport
::
createFromXml
(
n_it
,
default_ip
,
0
,
default_iface1
,
section
);
auto
transport1
=
MulticastReceiveTransport
::
createFromXml
(
n_it
,
0
);
if
(
checkExistTransport
(
transport1
->
ID
())
)
if
(
checkExistTransport
(
transport1
->
ID
())
)
{
{
...
@@ -1360,7 +1308,7 @@ void UNetExchange::initMulticastReceiverForNode(UniXML::iterator n_it,
...
@@ -1360,7 +1308,7 @@ void UNetExchange::initMulticastReceiverForNode(UniXML::iterator n_it,
}
}
}
}
unetinfo
<<
myname
<<
"(init): (node='"
<<
n_it
.
getProp
(
"name"
)
<<
"') add channel1 receiver "
<<
transport1
->
ID
()
<<
" iface: "
<<
default_iface1
<<
endl
;
unetinfo
<<
myname
<<
"(init): (node='"
<<
n_it
.
getProp
(
"name"
)
<<
"') add channel1 receiver "
<<
transport1
->
ID
()
<<
" iface: "
<<
transport1
->
iface
()
<<
endl
;
unetinfo
<<
myname
<<
"(init): receive (channel1) from multicast groups: "
<<
endl
;
unetinfo
<<
myname
<<
"(init): receive (channel1) from multicast groups: "
<<
endl
;
for
(
const
auto
&
gr
:
transport1
->
getGroups
()
)
for
(
const
auto
&
gr
:
transport1
->
getGroups
()
)
...
@@ -1383,12 +1331,12 @@ void UNetExchange::initMulticastReceiverForNode(UniXML::iterator n_it,
...
@@ -1383,12 +1331,12 @@ void UNetExchange::initMulticastReceiverForNode(UniXML::iterator n_it,
{
{
std
::
unique_ptr
<
MulticastReceiveTransport
>
transport2
=
nullptr
;
std
::
unique_ptr
<
MulticastReceiveTransport
>
transport2
=
nullptr
;
if
(
!
n_it
.
getProp
(
"unet_multicast_ip2"
).
empty
()
||
!
default_ip2
.
empty
()
)
if
(
!
n_it
.
getProp
(
"unet_multicast_ip2"
).
empty
()
)
transport2
=
MulticastReceiveTransport
::
createFromXml
(
n_it
,
default_ip2
,
2
,
default_iface2
,
section
);
transport2
=
MulticastReceiveTransport
::
createFromXml
(
n_it
,
2
);
if
(
transport2
)
// создаём читателя по второму каналу
if
(
transport2
)
// создаём читателя по второму каналу
{
{
unetinfo
<<
myname
<<
"(init): (node='"
<<
n_it
.
getProp
(
"name"
)
<<
"') add channel2 receiver "
<<
transport2
->
ID
()
<<
" iface: "
<<
default_iface2
<<
endl
;
unetinfo
<<
myname
<<
"(init): (node='"
<<
n_it
.
getProp
(
"name"
)
<<
"') add channel2 receiver "
<<
transport2
->
ID
()
<<
" iface: "
<<
transport2
->
iface
()
<<
endl
;
unetinfo
<<
myname
<<
"(init): receive(channel2) from multicast groups: "
<<
endl
;
unetinfo
<<
myname
<<
"(init): receive(channel2) from multicast groups: "
<<
endl
;
for
(
const
auto
&
gr
:
transport2
->
getGroups
()
)
for
(
const
auto
&
gr
:
transport2
->
getGroups
()
)
...
...
extensions/UNetUDP/UNetExchange.h
View file @
feb400cf
...
@@ -101,50 +101,38 @@ namespace uniset
...
@@ -101,50 +101,38 @@ namespace uniset
--prefix-nodes-confnode name. По умолчанию настройка ведётся по секции <nodes>
--prefix-nodes-confnode name. По умолчанию настройка ведётся по секции <nodes>
\section pgUNetUDP_ConfMulticast Пример конфигурирования (Multicast)
\section pgUNetUDP_ConfMulticast Пример конфигурирования (Multicast)
По умолчанию при считывании используется \b unet_multicast_ip (указанный в секции \<nodes>)
По умолчанию при считывании используется \b unet_multicast_ip и \b id узла - в качестве порта.
и \b id узла - в качестве порта.
Но можно переопределиять эти параметры, при помощи указания \b unet_multicast_port и/или \b unet_multicast_ip,
Но можно переопределиять эти параметры, при помощи указания \b unet_multicast_port и/или \b unet_multicast_ip,
у конкретного узла (\<item>).
у конкретного узла (\<item>).
Группы для подписки описываются в специальной секции \b \<multicast>. Секция \b \<recevive> описывает группы на которые
При этом в параметре unet_multicast_ip должен быть задан адрес multicast-групы на которую будет
подписывается узел. Секция \b \<send> описывает в какие группы данный узел будет посылать сообщения.
подписываться каждый receiver и в которую будет писать соответствующий sender.
По умолчанию для подключения к группе используется интерфейс ANY, но параметром
Секция \b \<receive> не является обязательной и если узел должен слушать все другие узлы, то достаточно у узла
unet_multicast_iface="192.168.1.1" можно задать интерфейс через который ожидаются multicast-пакеты.
прописать свойство \b unet_multicast_receive_from_all_nodes="1". При этом узел подпишется
на все группы указанные в секции \b \<send>(!) других узлов, секция \<receive> при этом игнорируется.
Если свойство \b unet_multicast_receive_from_all_nodes="0" или не указано и создана пустая секция \b \<receive/>,
то узел \b не будет слушать и получать сообщения.
В секции \b \<nodes param1 param2 ...> можно задавать умолчательный адрес \b unet_multicast_default_ip1=".." и \b unet_multicast_default_ip2="..".
Помимо этого можно определить умолчательный интерфейс на котором происходит подключение к группам
\b unet_multicast_default_iface1=".." и \b unet_multicast_default_iface2="..".
\warning В текущей реализации поддерживается только одна <send><group .../></send>!
Для посылающего процесса можно определить параметр \b unet_multicast_ttl задающий время жизни multicast пакетов.
По умолчанию ttl=1. А так же определить ip для сокета параметром \b unet_multicast_sender_ip. По умолчанию "0.0.0.0".
В данной реализации поддерживается работа в два канала. Соответствующие настройки для второго канала имеют индекс "2".
unet_multicast_ip2, unet_multicast_port2, unet_multicast_iface2
\code
\code
<nodes port="2809" unet_broadcast_ip="192.168.56.255">
<nodes port="2809" unet_broadcast_ip="192.168.56.255">
<item ip="127.0.0.1" name="LocalhostNode" textname="Локальный узел" unet_ignore="1
" unet_multicast_port="3000" unet_multicast_ip="192.168.57.255
">
<item ip="127.0.0.1" name="LocalhostNode" textname="Локальный узел" unet_ignore="1
0
">
<iocards>
<iocards>
...
...
</iocards>
</iocards>
</item>
</item>
<item ip="192.168.56.10" name="Node1" textname="Node1" unet_multicast_port="3001" unet_update_strategy="evloop"
<item id="3001" ip="192.168.56.10" name="Node1" textname="Node1" unet_update_strategy="evloop"
unet_multicast_receive_from_all_nodes="1">
unet_multicast_ip="224.0.0.1"
<multicast>
unet_multicast_port2="3031"
<send>
unet_multicast_ip2="225.0.0.1">
<group addr="239.255.1.1" addr2="239.255.2.1"/>
...
</send>
</multicast>
</item>
</item>
<item ip="192.168.56.11" name="Node2" textname="Node2" unet_multicast_port="3002">
<item id="3002" ip="192.168.56.11" name="Node2" textname="Node2">
<multicast>
unet_multicast_ip="224.0.0.2"
<receive>
unet_multicast_port2="3032"
<group addr="239.255.1.1" addr2="239.255.2.1"/>
unet_multicast_ip2="225.0.0.2">
</receive>
...
<send>
<group addr="239.255.1.1" addr2="239.255.2.1"/>
</send>
</multicast>
</item>
</item>
</nodes>
</nodes>
\endcode
\endcode
...
@@ -255,13 +243,7 @@ namespace uniset
...
@@ -255,13 +243,7 @@ namespace uniset
void
termReceivers
();
void
termReceivers
();
void
initMulticastTransport
(
UniXML
::
iterator
nodes
,
const
std
::
string
&
n_field
,
const
std
::
string
&
n_fvalue
,
const
std
::
string
&
prefix
);
void
initMulticastTransport
(
UniXML
::
iterator
nodes
,
const
std
::
string
&
n_field
,
const
std
::
string
&
n_fvalue
,
const
std
::
string
&
prefix
);
void
initMulticastReceiverForNode
(
UniXML
::
iterator
n_it
,
void
initMulticastReceiverForNode
(
UniXML
::
iterator
n_it
,
const
std
::
string
&
prefix
);
const
std
::
string
&
default_ip1
,
const
std
::
string
&
default_ip2
,
const
std
::
string
&
default_iface1
,
const
std
::
string
&
default_iface2
,
const
std
::
string
&
section
,
const
std
::
string
&
prefix
);
void
initUDPTransport
(
UniXML
::
iterator
nodes
,
const
std
::
string
&
n_field
,
const
std
::
string
&
n_fvalue
,
const
std
::
string
&
prefix
);
void
initUDPTransport
(
UniXML
::
iterator
nodes
,
const
std
::
string
&
n_field
,
const
std
::
string
&
n_fvalue
,
const
std
::
string
&
prefix
);
void
initIterators
()
noexcept
;
void
initIterators
()
noexcept
;
...
...
extensions/UNetUDP/tests/test_unetmulticast.cc
View file @
feb400cf
...
@@ -24,16 +24,16 @@ TEST_CASE("[UNetUDP]: multicast setup", "[unetudp][multicast][config]")
...
@@ -24,16 +24,16 @@ TEST_CASE("[UNetUDP]: multicast setup", "[unetudp][multicast][config]")
REQUIRE
(
it
.
getName
()
==
"item"
);
REQUIRE
(
it
.
getName
()
==
"item"
);
REQUIRE
(
it
.
getProp
(
"name"
)
==
"localhost"
);
REQUIRE
(
it
.
getProp
(
"name"
)
==
"localhost"
);
REQUIRE_NOTHROW
(
MulticastReceiveTransport
::
createFromXml
(
it
,
"192.168.0.1"
,
0
)
);
REQUIRE_NOTHROW
(
MulticastReceiveTransport
::
createFromXml
(
it
,
0
)
);
REQUIRE_NOTHROW
(
MulticastReceiveTransport
::
createFromXml
(
it
,
"192.168.1.1"
,
2
)
);
REQUIRE_NOTHROW
(
MulticastReceiveTransport
::
createFromXml
(
it
,
2
)
);
REQUIRE_NOTHROW
(
MulticastSendTransport
::
createFromXml
(
it
,
"192.168.0.1"
,
0
)
);
REQUIRE_NOTHROW
(
MulticastSendTransport
::
createFromXml
(
it
,
0
)
);
REQUIRE_NOTHROW
(
MulticastSendTransport
::
createFromXml
(
it
,
"192.168.1.1"
,
2
)
);
REQUIRE_NOTHROW
(
MulticastSendTransport
::
createFromXml
(
it
,
2
)
);
auto
t1
=
MulticastReceiveTransport
::
createFromXml
(
it
,
"192.168.1.1"
,
2
);
auto
t1
=
MulticastReceiveTransport
::
createFromXml
(
it
,
2
);
REQUIRE
(
t1
->
toString
()
==
"
127.0.1.1:2999
"
);
REQUIRE
(
t1
->
toString
()
==
"
225.0.0.1:3030
"
);
auto
t2
=
MulticastSendTransport
::
createFromXml
(
it
,
"192.168.1.1"
,
2
);
auto
t2
=
MulticastSendTransport
::
createFromXml
(
it
,
2
);
REQUIRE
(
t2
->
toString
()
==
"
127.0.1.1:2999
"
);
REQUIRE
(
t2
->
toString
()
==
"
0.0.0.0:3030
"
);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
TEST_CASE
(
"[UNetUDP]: multicast transport"
,
"[unetudp][multicast][transport]"
)
TEST_CASE
(
"[UNetUDP]: multicast transport"
,
"[unetudp][multicast][transport]"
)
...
@@ -47,12 +47,12 @@ TEST_CASE("[UNetUDP]: multicast transport", "[unetudp][multicast][transport]")
...
@@ -47,12 +47,12 @@ TEST_CASE("[UNetUDP]: multicast transport", "[unetudp][multicast][transport]")
REQUIRE
(
it
.
getName
()
==
"item"
);
REQUIRE
(
it
.
getName
()
==
"item"
);
REQUIRE
(
it
.
getProp
(
"name"
)
==
"localhost"
);
REQUIRE
(
it
.
getProp
(
"name"
)
==
"localhost"
);
auto
t1
=
MulticastReceiveTransport
::
createFromXml
(
it
,
"0.0.0.0"
,
0
);
auto
t1
=
MulticastReceiveTransport
::
createFromXml
(
it
,
0
);
REQUIRE
(
t1
->
toString
()
==
"
0.0.0.0
:3000"
);
REQUIRE
(
t1
->
toString
()
==
"
224.0.0.1
:3000"
);
REQUIRE
(
t1
->
createConnection
(
false
,
5000
,
true
)
);
REQUIRE
(
t1
->
createConnection
(
false
,
5000
,
true
)
);
auto
t2
=
MulticastSendTransport
::
createFromXml
(
it
,
"127.0.0.1"
,
0
);
auto
t2
=
MulticastSendTransport
::
createFromXml
(
it
,
0
);
REQUIRE
(
t2
->
toString
()
==
"
127.0.0.1
:3000"
);
REQUIRE
(
t2
->
toString
()
==
"
0.0.0.0
:3000"
);
REQUIRE
(
t2
->
getGroupAddress
()
==
Poco
::
Net
::
SocketAddress
(
"224.0.0.1"
,
3000
)
);
REQUIRE
(
t2
->
getGroupAddress
()
==
Poco
::
Net
::
SocketAddress
(
"224.0.0.1"
,
3000
)
);
REQUIRE
(
t2
->
createConnection
(
false
,
5000
)
);
REQUIRE
(
t2
->
createConnection
(
false
,
5000
)
);
...
...
extensions/UNetUDP/tests/test_unetudp_multicast.cc
View file @
feb400cf
...
@@ -49,8 +49,8 @@ static void initHelpers()
...
@@ -49,8 +49,8 @@ static void initHelpers()
{
{
std
::
vector
<
Poco
::
Net
::
IPAddress
>
groups
;
std
::
vector
<
Poco
::
Net
::
IPAddress
>
groups
;
groups
.
emplace_back
(
"224.0.0.1"
);
groups
.
emplace_back
(
"224.0.0.1"
);
udp_r
=
make_unique
<
MulticastReceiveTransport
>
(
"
0.0.0.0"
,
3000
,
groups
,
"127.0.0.1
"
);
udp_r
=
make_unique
<
MulticastReceiveTransport
>
(
"
224.0.0.1"
,
3000
,
groups
,
"
"
);
REQUIRE
(
udp_r
->
toString
()
==
"
0.0.0.0
:3000"
);
REQUIRE
(
udp_r
->
toString
()
==
"
224.0.0.1
:3000"
);
REQUIRE
(
udp_r
->
createConnection
(
false
,
5000
,
true
)
);
REQUIRE
(
udp_r
->
createConnection
(
false
,
5000
,
true
)
);
// pause for igmp message
// pause for igmp message
msleep
(
3000
);
msleep
(
3000
);
...
@@ -58,8 +58,8 @@ static void initHelpers()
...
@@ -58,8 +58,8 @@ static void initHelpers()
if
(
!
udp_s
)
if
(
!
udp_s
)
{
{
udp_s
=
make_unique
<
MulticastSendTransport
>
(
"
127.0.0.1"
,
3002
,
"224.0.0.1
"
,
3002
);
udp_s
=
make_unique
<
MulticastSendTransport
>
(
"
0.0.0.0"
,
3002
,
"224.0.0.2
"
,
3002
);
REQUIRE
(
udp_s
->
toString
()
==
"
127.0.0.1
:3002"
);
REQUIRE
(
udp_s
->
toString
()
==
"
0.0.0.0
:3002"
);
REQUIRE
(
udp_s
->
createConnection
(
false
,
5000
)
);
REQUIRE
(
udp_s
->
createConnection
(
false
,
5000
)
);
// pause for igmp message
// pause for igmp message
msleep
(
3000
);
msleep
(
3000
);
...
...
extensions/UNetUDP/tests/unetudp-test-configure.xml
View file @
feb400cf
...
@@ -32,41 +32,20 @@
...
@@ -32,41 +32,20 @@
</settings>
</settings>
<ObjectsMap
idfromfile=
"1"
>
<ObjectsMap
idfromfile=
"1"
>
<nodes
port=
"2809"
unet_broadcast_ip=
"127.255.255.255"
unet_broadcast_ip2=
"badip"
unet_multicast_ip=
"0.0.0.0"
>
<nodes
port=
"2809"
unet_broadcast_ip=
"127.255.255.255"
unet_broadcast_ip2=
"badip"
>
<item
id=
"3000"
ip=
"127.0.0.1"
name=
"localhost"
textname=
"Локальный узел"
unet_ignore=
"0"
unet_port=
"3000"
unet_multicast_ip2=
"127.0.1.1"
unet_multicast_port2=
"2999"
unet_multicast_receive_from_all_nodes=
"1"
>
<item
id=
"3000"
ip=
"127.0.0.1"
name=
"localhost"
textname=
"Локальный узел"
unet_ignore=
"0"
unet_port=
"3000"
<multicast>
unet_multicast_ip=
"224.0.0.1"
<receive>
unet_multicast_ip2=
"225.0.0.1"
<group
addr=
"224.0.0.1"
addr2=
"225.0.0.2"
/>
unet_multicast_port2=
"3030"
/>
<group
addr=
"224.0.0.3"
addr2=
"225.0.0.3"
/>
</receive>
<send>
<group
addr=
"224.0.0.1"
addr2=
"225.0.0.1"
/>
</send>
</multicast>
</item>
<item
id=
"3001"
ip=
"127.0.0.1"
name=
"localhost1"
textname=
"Локальный узел"
unet_ignore=
"1"
unet_port=
"3001"
/>
<item
id=
"3001"
ip=
"127.0.0.1"
name=
"localhost1"
textname=
"Локальный узел"
unet_ignore=
"1"
unet_port=
"3001"
/>
<item
id=
"3002"
ip=
"192.168.56.10"
name=
"Node1"
textname=
"Node1"
unet_ignore=
"0"
unet_respond_id=
"Node1_Not_Respond_S"
unet_respond_invert=
"1"
unet_channelswitchcount_id=
"Node1_ChannelSwitchCount_AS"
unet_multicast_receive_from_all_nodes=
"1"
>
<item
id=
"3002"
ip=
"192.168.56.10"
name=
"Node1"
textname=
"Node1"
unet_ignore=
"0"
unet_respond_id=
"Node1_Not_Respond_S"
unet_respond_invert=
"1"
unet_channelswitchcount_id=
"Node1_ChannelSwitchCount_AS"
<multicast>
unet_multicast_ip=
"224.0.0.2"
<receive>
unet_multicast_ip2=
"225.0.0.2"
<group
addr=
"224.0.0.1"
addr2=
"225.0.0.1"
/>
unet_multicast_port2=
"3032"
/>
<group
addr=
"224.0.0.3"
addr2=
"225.0.0.3"
/>
<item
id=
"3003"
ip=
"192.168.56.11"
name=
"Node2"
textname=
"Node2"
unet_ignore=
"0"
unet_respond_id=
"Node2_Respond_S"
unet_lostpackets_id=
"Node2_LostPackets_AS"
unet_numchannel_id=
"Node2_NumChannel_AS"
</receive>
unet_multicast_ip=
"224.0.0.3"
<send>
unet_multicast_ip2=
"225.0.0.3"
<group
addr=
"224.0.0.2"
addr2=
"225.0.0.2"
/>
unet_multicast_port2=
"3033"
/>
</send>
</multicast>
</item>
<item
id=
"3003"
ip=
"192.168.56.11"
name=
"Node2"
textname=
"Node2"
unet_ignore=
"0"
unet_respond_id=
"Node2_Respond_S"
unet_lostpackets_id=
"Node2_LostPackets_AS"
unet_numchannel_id=
"Node2_NumChannel_AS"
unet_multicast_receive_from_all_nodes=
"1"
>
<multicast>
<receive>
<group
addr=
"224.0.0.1"
addr2=
"225.0.0.1"
/>
<group
addr=
"224.0.0.2"
addr2=
"225.0.0.2"
/>
</receive>
<send>
<group
addr=
"224.0.0.3"
addr2=
"225.0.0.3"
/>
</send>
</multicast>
</item>
</nodes>
</nodes>
<!-- ************************ Датчики ********************** -->
<!-- ************************ Датчики ********************** -->
<sensors
name=
"Sensors"
>
<sensors
name=
"Sensors"
>
...
...
extensions/UNetUDP/unet-multicast-tester.cc
View file @
feb400cf
...
@@ -354,6 +354,13 @@ int main(int argc, char* argv[])
...
@@ -354,6 +354,13 @@ int main(int argc, char* argv[])
return
1
;
return
1
;
}
}
if
(
verb
)
{
cout
<<
"(send): ip="
<<
s_host
<<
":"
<<
port
<<
" group="
<<
groups
[
0
].
toString
()
<<
":"
<<
port
<<
endl
;
}
// supporte only first group address
// supporte only first group address
auto
udp
=
std
::
make_shared
<
MulticastSendTransport
>
(
s_host
,
port
,
groups
[
0
].
toString
(),
port
);
auto
udp
=
std
::
make_shared
<
MulticastSendTransport
>
(
s_host
,
port
,
groups
[
0
].
toString
(),
port
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment