Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NetworkedGraphicsMV3500
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Savage
NetworkedGraphicsMV3500
Commits
f42dcc7b
Commit
f42dcc7b
authored
4 years ago
by
brutzman
Browse files
Options
Downloads
Patches
Plain Diff
consistent address, port ordering and output on console
parent
29cf8d5f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/src/OpenDis7Examples/AllPduReceiver.java
+5
-5
5 additions, 5 deletions
examples/src/OpenDis7Examples/AllPduReceiver.java
examples/src/OpenDis7Examples/AllPduSender.java
+13
-11
13 additions, 11 deletions
examples/src/OpenDis7Examples/AllPduSender.java
with
18 additions
and
16 deletions
examples/src/OpenDis7Examples/AllPduReceiver.java
+
5
−
5
View file @
f42dcc7b
...
@@ -10,8 +10,8 @@ import java.util.ArrayList;
...
@@ -10,8 +10,8 @@ import java.util.ArrayList;
public
class
AllPduReceiver
public
class
AllPduReceiver
{
{
public
static
final
int
DEFAULT_MULTICAST_PORT
=
AllPduSender
.
DEFAULT_MULTICAST_PORT
;
public
static
final
String
DEFAULT_MULTICAST_ADDRESS
=
AllPduSender
.
DEFAULT_MULTICAST_ADDRESS
;
public
static
final
String
DEFAULT_MULTICAST_ADDRESS
=
AllPduSender
.
DEFAULT_MULTICAST_ADDRESS
;
public
static
final
int
DEFAULT_MULTICAST_PORT
=
AllPduSender
.
DEFAULT_MULTICAST_PORT
;
public
static
final
boolean
USE_FAST_ESPDU
=
false
;
public
static
final
boolean
USE_FAST_ESPDU
=
false
;
public
static
void
main
(
String
args
[])
public
static
void
main
(
String
args
[])
...
@@ -24,12 +24,12 @@ public class AllPduReceiver
...
@@ -24,12 +24,12 @@ public class AllPduReceiver
try
{
try
{
System
.
out
.
println
(
"OpenDis7Examples.AllPduReceiver started..."
);
System
.
out
.
println
(
"OpenDis7Examples.AllPduReceiver started..."
);
if
(
args
.
length
==
2
)
{
if
(
args
.
length
==
2
)
{
socket
=
ne
w
MulticastSocket
(
Integer
.
parseInt
(
args
[
0
])
)
;
address
=
I
ne
tAddress
.
getByName
(
args
[
0
]);
address
=
I
ne
tAddress
.
getByName
(
args
[
1
]);
socket
=
ne
w
MulticastSocket
(
Integer
.
parseInt
(
args
[
1
])
)
;
}
}
else
{
else
{
System
.
out
.
println
(
"Usage: AllPduReceiver
<port>
<multicast group>"
);
System
.
out
.
println
(
"Usage: AllPduReceiver <multicast group>
<port>
"
);
System
.
out
.
println
(
"Default: AllPduReceiver "
+
DEFAULT_MULTICAST_
PORT
+
" "
+
DEFAULT_MULTICAST_
ADDRESS
);
System
.
out
.
println
(
"Default: AllPduReceiver
"
+
DEFAULT_MULTICAST_
ADDRESS
+
"
"
+
DEFAULT_MULTICAST_
PORT
);
socket
=
new
MulticastSocket
(
DEFAULT_MULTICAST_PORT
);
socket
=
new
MulticastSocket
(
DEFAULT_MULTICAST_PORT
);
address
=
InetAddress
.
getByName
(
DEFAULT_MULTICAST_ADDRESS
);
address
=
InetAddress
.
getByName
(
DEFAULT_MULTICAST_ADDRESS
);
}
}
...
...
This diff is collapsed.
Click to expand it.
examples/src/OpenDis7Examples/AllPduSender.java
+
13
−
11
View file @
f42dcc7b
...
@@ -18,7 +18,7 @@ import edu.nps.moves.dis7.enumerations.*;
...
@@ -18,7 +18,7 @@ import edu.nps.moves.dis7.enumerations.*;
public
class
AllPduSender
public
class
AllPduSender
{
{
/** Default multicast group address we send on. */
/** Default multicast group address we send on. */
public
static
final
String
DEFAULT_MULTICAST_ADDRESS
=
"225.4.5.6"
;
//
"239.1.2.3"; // PduRecorder "225.4.5.6"; //
public
static
final
String
DEFAULT_MULTICAST_ADDRESS
=
"239.1.2.3"
;
// PduRecorder "225.4.5.6"; //
/** Default multicast port used, matches Wireshark DIS capture default */
/** Default multicast port used, matches Wireshark DIS capture default */
public
static
final
int
DEFAULT_MULTICAST_PORT
=
3000
;
public
static
final
int
DEFAULT_MULTICAST_PORT
=
3000
;
...
@@ -29,19 +29,19 @@ public class AllPduSender
...
@@ -29,19 +29,19 @@ public class AllPduSender
/** Number of complete loops to perform */
/** Number of complete loops to perform */
private
int
SEND_LOOPS_TO_PERFORM
=
10
;
private
int
SEND_LOOPS_TO_PERFORM
=
10
;
private
int
port
;
private
static
InetAddress
multicastAddress
;
private
InetAddress
multicastAddress
;
private
static
int
port
;
public
AllPduSender
(
int
port
,
String
m
ulticast
)
{
public
AllPduSender
(
String
newMulticastAddress
,
int
newM
ulticast
Port
)
{
this
.
port
=
DEFAULT_MULTICAST_PORT
;
this
.
port
=
DEFAULT_MULTICAST_PORT
;
try
try
{
{
this
.
port
=
port
;
multicastAddress
=
InetAddress
.
getByName
(
newMulticastAddress
);
multicastAddress
=
InetAddress
.
getByName
(
multicast
);
if
(!
multicastAddress
.
isMulticastAddress
())
if
(!
multicastAddress
.
isMulticastAddress
())
{
{
System
.
out
.
println
(
"Not a multicast address: "
+
m
ulticast
);
System
.
out
.
println
(
"Not a multicast address: "
+
newM
ulticast
Address
);
}
}
this
.
port
=
newMulticastPort
;
}
}
catch
(
UnknownHostException
e
)
{
catch
(
UnknownHostException
e
)
{
System
.
out
.
println
(
"Unable to open socket: "
+
e
);
System
.
out
.
println
(
"Unable to open socket: "
+
e
);
...
@@ -500,14 +500,16 @@ public class AllPduSender
...
@@ -500,14 +500,16 @@ public class AllPduSender
if
(
args
.
length
==
2
)
if
(
args
.
length
==
2
)
{
{
allPduSender
=
new
AllPduSender
(
Integer
.
parseInt
(
args
[
0
]),
args
[
1
]);
allPduSender
=
new
AllPduSender
(
args
[
0
],
Integer
.
parseInt
(
args
[
1
]));
System
.
out
.
println
(
"Usage: AllPduSender <multicast group> <port>"
);
System
.
out
.
println
(
"Actual: AllPduSender "
+
multicastAddress
.
getHostAddress
()
+
" "
+
port
);
totalSentPdus
=
allPduSender
.
run
();
totalSentPdus
=
allPduSender
.
run
();
}
}
else
else
{
{
System
.
out
.
println
(
"Usage: AllPduSender
<port>
<multicast group>"
);
System
.
out
.
println
(
"Usage: AllPduSender <multicast group>
<port>
"
);
System
.
out
.
println
(
"Default: AllPduSender "
+
DEFAULT_MULTICAST_
PORT
+
" "
+
DEFAULT_MULTICAST_
ADDRESS
);
System
.
out
.
println
(
"Default: AllPduSender "
+
DEFAULT_MULTICAST_
ADDRESS
+
" "
+
DEFAULT_MULTICAST_
PORT
);
allPduSender
=
new
AllPduSender
(
DEFAULT_MULTICAST_
PORT
,
DEFAULT_MULTICAST_
ADDRESS
);
allPduSender
=
new
AllPduSender
(
DEFAULT_MULTICAST_
ADDRESS
,
DEFAULT_MULTICAST_
PORT
);
totalSentPdus
=
allPduSender
.
run
();
totalSentPdus
=
allPduSender
.
run
();
}
}
System
.
out
.
println
(
"OpenDis7Examples.AllPduSender complete, sent "
+
totalSentPdus
+
" PDUs total."
);
System
.
out
.
println
(
"OpenDis7Examples.AllPduSender complete, sent "
+
totalSentPdus
+
" PDUs total."
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment