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
afee964b
Commit
afee964b
authored
5 years ago
by
brutzman
Browse files
Options
Downloads
Patches
Plain Diff
put loopsize parameter where it is easily recognized and modified, renamed as LOOPSIZE
parent
ccd8aebf
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/src/UdpMulticastHttpExamples/MulticastSender.java
+5
-4
5 additions, 4 deletions
examples/src/UdpMulticastHttpExamples/MulticastSender.java
with
5 additions
and
4 deletions
examples/src/UdpMulticastHttpExamples/MulticastSender.java
+
5
−
4
View file @
afee964b
...
@@ -23,7 +23,8 @@ public class MulticastSender {
...
@@ -23,7 +23,8 @@ public class MulticastSender {
/** Time to live: how many router-decrement levels can be crossed */
/** Time to live: how many router-decrement levels can be crossed */
public
static
final
int
TTL
=
10
;
public
static
final
int
TTL
=
10
;
public
static
final
int
loopSize
=
20
;
// 20000
/** How many packets to send prior to termination */
public
static
final
int
LOOPSIZE
=
20
;
// 20000
public
static
final
String
QUIT_SENTINEL
=
"QUIT QUIT QUIT!"
;
public
static
final
String
QUIT_SENTINEL
=
"QUIT QUIT QUIT!"
;
...
@@ -49,7 +50,7 @@ public class MulticastSender {
...
@@ -49,7 +50,7 @@ public class MulticastSender {
multicastSocket
.
joinGroup
(
multicastAddress
);
multicastSocket
.
joinGroup
(
multicastAddress
);
// You can join multiple groups here
// You can join multiple groups here
for
(
int
index
=
0
;
index
<
loopSize
;
index
++)
for
(
int
index
=
0
;
index
<
LOOPSIZE
;
index
++)
{
{
// Put together a message with binary content. "ByteArrayOutputStream"
// Put together a message with binary content. "ByteArrayOutputStream"
// is a java.io utility that lets us put together an array of binary
// is a java.io utility that lets us put together an array of binary
...
@@ -58,7 +59,7 @@ public class MulticastSender {
...
@@ -58,7 +59,7 @@ public class MulticastSender {
DataOutputStream
dos
=
new
DataOutputStream
(
baos
);
DataOutputStream
dos
=
new
DataOutputStream
(
baos
);
// Put together an updated packet to send
// Put together an updated packet to send
if
(
index
<
loopSize
-
1
)
if
(
index
<
LOOPSIZE
-
1
)
{
{
// Put together an updated packet to send
// Put together an updated packet to send
dos
.
writeChars
(
System
.
getProperty
(
"user.name"
)
+
": "
);
dos
.
writeChars
(
System
.
getProperty
(
"user.name"
)
+
": "
);
...
@@ -73,7 +74,7 @@ public class MulticastSender {
...
@@ -73,7 +74,7 @@ public class MulticastSender {
DatagramPacket
packet
=
new
DatagramPacket
(
buffer
,
buffer
.
length
,
multicastAddress
,
DESTINATION_PORT
);
DatagramPacket
packet
=
new
DatagramPacket
(
buffer
,
buffer
.
length
,
multicastAddress
,
DESTINATION_PORT
);
multicastSocket
.
send
(
packet
);
multicastSocket
.
send
(
packet
);
System
.
out
.
println
(
"Sent multicast packet "
+
index
+
" of "
+
loopSize
);
System
.
out
.
println
(
"Sent multicast packet "
+
index
+
" of "
+
LOOPSIZE
);
// How fast does this go? Does UDP try to slow it down, or does
// How fast does this go? Does UDP try to slow it down, or does
// this cause network problems? (hint: yes for an unlimited send
// this cause network problems? (hint: yes for an unlimited send
...
...
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