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
40168d5b
Commit
40168d5b
authored
7 years ago
by
Brutzman, Don
Browse files
Options
Downloads
Patches
Plain Diff
fix warnings, rename class to match filename
parent
3ac922ba
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
projects/Assignments/homework3/OpenDisPduSender.java
+16
-10
16 additions, 10 deletions
projects/Assignments/homework3/OpenDisPduSender.java
with
16 additions
and
10 deletions
projects/Assignments/homework3/OpenDisPduSender.java
+
16
−
10
View file @
40168d5b
package
edu.nps.moves.examples
;
//
package edu.nps.moves.examples;
// copy example from OpenDIS distribution, modify to serve as template
import
java.io.*
;
import
java.io.*
;
import
java.net.*
;
import
java.net.*
;
...
@@ -15,28 +15,30 @@ import edu.nps.moves.disenum.*;
...
@@ -15,28 +15,30 @@ import edu.nps.moves.disenum.*;
* @author DMcG
* @author DMcG
* @version $Id:$
* @version $Id:$
*/
*/
public
class
PduSender
{
public
class
OpenDis
PduSender
{
public
static
final
int
PORT
=
6204
0
;
public
static
final
int
PORT
=
300
0
;
public
static
final
String
MULTICAST_ADDRESS
=
"239.1.2.3"
;
public
static
final
String
MULTICAST_ADDRESS
=
"239.1.2.3"
;
private
int
port
;
private
int
port
;
InetAddress
multicastAddress
;
InetAddress
multicastAddress
;
public
PduSender
(
int
port
,
String
multicast
)
{
public
OpenDisPduSender
(
int
port
,
String
multicast
)
{
try
{
try
{
this
.
port
=
port
;
this
.
port
=
port
;
multicastAddress
=
InetAddress
.
getByName
(
multicast
);
multicastAddress
=
InetAddress
.
getByName
(
multicast
);
if
(!
multicastAddress
.
isMulticastAddress
())
{
if
(!
multicastAddress
.
isMulticastAddress
())
{
System
.
out
.
println
(
"Not a multicast address: "
+
multicast
);
System
.
out
.
println
(
"Not a multicast address: "
+
multicast
);
}
}
}
catch
(
Exception
e
)
{
}
System
.
out
.
println
(
"Unable to open socket"
);
catch
(
UnknownHostException
e
)
{
System
.
out
.
println
(
"Unable to open socket: "
+
e
);
}
}
}
}
public
void
run
()
{
public
void
run
()
{
try
{
try
{
List
<
Pdu
>
generatedPdus
=
new
ArrayList
<
Pdu
>();
List
<
Pdu
>
generatedPdus
=
new
ArrayList
<>();
// Loop through all the enumerated PDU types, create a PDU for each type,
// Loop through all the enumerated PDU types, create a PDU for each type,
// and add that PDU to a list.
// and add that PDU to a list.
...
@@ -148,17 +150,21 @@ public class PduSender {
...
@@ -148,17 +150,21 @@ public class PduSender {
//PduContainer container = new PduContainer();
//PduContainer container = new PduContainer();
//container.setPdus(generatedPdus);
//container.setPdus(generatedPdus);
//container.marshallToXml("examplePdus.xml");
//container.marshallToXml("examplePdus.xml");
}
catch
(
Exception
e
)
{
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
);
System
.
out
.
println
(
e
);
}
}
}
}
public
static
void
main
(
String
args
[])
{
public
static
void
main
(
String
args
[])
{
if
(
args
.
length
==
2
)
{
if
(
args
.
length
==
2
)
{
PduSender
sender
=
new
PduSender
(
Integer
.
parseInt
(
args
[
0
]),
args
[
1
]);
OpenDis
PduSender
sender
=
new
OpenDis
PduSender
(
Integer
.
parseInt
(
args
[
0
]),
args
[
1
]);
sender
.
run
();
sender
.
run
();
}
else
{
}
else
{
System
.
out
.
println
(
"Usage: PduSender <port> <multicast group>"
);
System
.
out
.
println
(
"Usage: OpenDisPduSender <port> <multicast group>"
);
System
.
out
.
println
(
"Default: OpenDisPduSender "
+
PORT
+
" "
+
MULTICAST_ADDRESS
);
OpenDisPduSender
sender
=
new
OpenDisPduSender
(
PORT
,
MULTICAST_ADDRESS
);
sender
.
run
();
}
}
}
}
}
}
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