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
ffdcf30d
Commit
ffdcf30d
authored
6 years ago
by
Brutzman, Don
Browse files
Options
Downloads
Patches
Plain Diff
source cleanup
parent
8c1461e2
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
projects/UdpExample1/UdpReceiver/src/udpreceiver/UdpReceiver.java
+1
-2
1 addition, 2 deletions
.../UdpExample1/UdpReceiver/src/udpreceiver/UdpReceiver.java
projects/UdpExample1/UdpSender/src/udpsender/UdpSender.java
+4
-5
4 additions, 5 deletions
projects/UdpExample1/UdpSender/src/udpsender/UdpSender.java
with
5 additions
and
7 deletions
projects/UdpExample1/UdpReceiver/src/udpreceiver/UdpReceiver.java
+
1
−
2
View file @
ffdcf30d
...
@@ -43,10 +43,9 @@ public class UdpReceiver
...
@@ -43,10 +43,9 @@ public class UdpReceiver
System
.
out
.
println
(
"first value: "
+
first
+
" second value: "
+
second
);
System
.
out
.
println
(
"first value: "
+
first
+
" second value: "
+
second
);
}
}
}
}
catch
(
Exception
e
)
catch
(
IO
Exception
e
)
{
{
System
.
out
.
println
(
e
);
System
.
out
.
println
(
e
);
}
}
}
}
}
}
This diff is collapsed.
Click to expand it.
projects/UdpExample1/UdpSender/src/udpsender/UdpSender.java
+
4
−
5
View file @
ffdcf30d
package
udpsender
;
package
udpsender
;
import
java.io.*
;
import
java.io.*
;
...
@@ -34,7 +33,7 @@ public class UdpSender
...
@@ -34,7 +33,7 @@ public class UdpSender
DataOutputStream
dos
=
new
DataOutputStream
(
baos
);
DataOutputStream
dos
=
new
DataOutputStream
(
baos
);
// alternatives: writeFloat(17.0f); writeInt(17); writeUTF("\"hello MV3500 no really\"");
// alternatives: writeFloat(17.0f); writeInt(17); writeUTF("\"hello MV3500 no really\"");
dos
.
writeFloat
(
17.0f
);
dos
.
writeFloat
(
17.0f
);
dos
.
writeFloat
(
2
3
.0f
);
dos
.
writeFloat
(
2
4
.0f
);
byte
[]
buffer
=
baos
.
toByteArray
();
byte
[]
buffer
=
baos
.
toByteArray
();
// Put together a packet to send
// Put together a packet to send
...
@@ -50,14 +49,14 @@ public class UdpSender
...
@@ -50,14 +49,14 @@ public class UdpSender
// that you haven't received a duplicate UDP packet, out of
// that you haven't received a duplicate UDP packet, out of
// order packet, or dropped packet?
// order packet, or dropped packet?
for
(
int
i
d
x
=
0
;
i
d
x
<
100
;
i
d
x
++)
// avoid infinite send loops in code, can be hard to kill!
for
(
int
i
nde
x
=
1
;
i
nde
x
<
=
100
;
i
nde
x
++)
// avoid infinite send loops in code, can be hard to kill!
{
{
udpSocket
.
send
(
packet
);
udpSocket
.
send
(
packet
);
Thread
.
sleep
(
1000
);
// Send 100, one per second
Thread
.
sleep
(
1000
);
// Send 100, one per second
System
.
out
.
println
(
"Sent packet "
+
i
d
x
+
" of 100"
);
System
.
out
.
println
(
"Sent packet "
+
i
nde
x
+
" of 100"
);
}
}
}
}
catch
(
Exception
e
)
catch
(
IOException
|
Interrupted
Exception
e
)
{
{
System
.
out
.
println
(
e
);
System
.
out
.
println
(
e
);
}
}
...
...
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