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
f44ffab3
Commit
f44ffab3
authored
4 years ago
by
terry-norbraten
Browse files
Options
Downloads
Patches
Plain Diff
use given local vars
parent
909ca3f6
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
src/edu/nps/moves/dis7/examples/EspduSender.java
+5
-4
5 additions, 4 deletions
src/edu/nps/moves/dis7/examples/EspduSender.java
with
5 additions
and
4 deletions
src/edu/nps/moves/dis7/examples/EspduSender.java
+
5
−
4
View file @
f44ffab3
...
@@ -69,6 +69,7 @@ public class EspduSender
...
@@ -69,6 +69,7 @@ public class EspduSender
// Network mode: unicast, multicast, broadcast
// Network mode: unicast, multicast, broadcast
String
networkModeString
=
systemProperties
.
getProperty
(
"networkMode"
);
// unicast or multicast or broadcast
String
networkModeString
=
systemProperties
.
getProperty
(
"networkMode"
);
// unicast or multicast or broadcast
InetSocketAddress
group
=
null
;
// Set up a socket to send information
// Set up a socket to send information
try
{
try
{
...
@@ -76,7 +77,7 @@ public class EspduSender
...
@@ -76,7 +77,7 @@ public class EspduSender
if
(
portString
!=
null
)
if
(
portString
!=
null
)
port
=
Integer
.
parseInt
(
portString
);
port
=
Integer
.
parseInt
(
portString
);
socket
=
new
MulticastSocket
(
port
);
socket
=
new
MulticastSocket
();
// Where we send packets to, the destination IP address
// Where we send packets to, the destination IP address
if
(
destinationIpString
!=
null
)
{
if
(
destinationIpString
!=
null
)
{
...
@@ -96,7 +97,7 @@ public class EspduSender
...
@@ -96,7 +97,7 @@ public class EspduSender
throw
new
RuntimeException
(
"Sending to multicast address, but destination address "
+
destinationIp
.
toString
()
+
" is not multicast"
);
throw
new
RuntimeException
(
"Sending to multicast address, but destination address "
+
destinationIp
.
toString
()
+
" is not multicast"
);
}
}
InetSocketAddress
group
=
new
InetSocketAddress
(
destinationIp
,
port
);
group
=
new
InetSocketAddress
(
destinationIp
,
port
);
socket
.
joinGroup
(
group
,
DisThreadedNetIF
.
findIpv4Interface
());
socket
.
joinGroup
(
group
,
DisThreadedNetIF
.
findIpv4Interface
());
}
}
}
// end networkModeString
}
// end networkModeString
...
@@ -232,10 +233,10 @@ public class EspduSender
...
@@ -232,10 +233,10 @@ public class EspduSender
for
(
InetAddress
broadcast
:
broadcastAddresses
)
{
for
(
InetAddress
broadcast
:
broadcastAddresses
)
{
System
.
out
.
println
(
"Sending broadcast datagram packet to "
+
broadcast
);
System
.
out
.
println
(
"Sending broadcast datagram packet to "
+
broadcast
);
packet
=
new
DatagramPacket
(
data
,
data
.
length
,
broadcast
,
DisThreadedNetIF
.
DEFAULT_DIS_PORT
);
packet
=
new
DatagramPacket
(
data
,
data
.
length
,
broadcast
,
port
);
socket
.
send
(
packet
);
socket
.
send
(
packet
);
// TODO experiment with these! 8)
// TODO experiment with these! 8)
packet
=
new
DatagramPacket
(
fireArray
,
fireArray
.
length
,
broadcast
,
DisThreadedNetIF
.
DEFAULT_DIS_PORT
);
// alternate
packet
=
new
DatagramPacket
(
fireArray
,
fireArray
.
length
,
broadcast
,
port
);
// alternate
socket
.
send
(
packet
);
socket
.
send
(
packet
);
}
}
...
...
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