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
9030d266
Commit
9030d266
authored
5 years ago
by
Terry D. Norbraten
Browse files
Options
Downloads
Patches
Plain Diff
minimize object creation in loops
parent
a5563490
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/edu/nps/moves/dis7/utilities/DisNetworking.java
+3
-2
3 additions, 2 deletions
src/edu/nps/moves/dis7/utilities/DisNetworking.java
src/edu/nps/moves/dis7/utilities/DisThreadedNetIF.java
+1
-1
1 addition, 1 deletion
src/edu/nps/moves/dis7/utilities/DisThreadedNetIF.java
with
4 additions
and
3 deletions
src/edu/nps/moves/dis7/utilities/DisNetworking.java
+
3
−
2
View file @
9030d266
...
@@ -81,8 +81,8 @@ public class DisNetworking
...
@@ -81,8 +81,8 @@ public class DisNetworking
rsocket
=
new
MulticastSocket
(
DIS_PORT
);
rsocket
=
new
MulticastSocket
(
DIS_PORT
);
InetAddress
maddr
=
InetAddress
.
getByName
(
MCAST_GROUP
);
InetAddress
maddr
=
InetAddress
.
getByName
(
MCAST_GROUP
);
rsocket
.
setNetworkInterface
(
findIp4Interface
()
);
InetSocketAddress
group
=
new
InetSocketAddress
(
maddr
,
DIS_PORT
);
rsocket
.
joinGroup
(
maddr
);
rsocket
.
joinGroup
(
group
,
findIp4Interface
()
);
byte
buffer
[]
=
new
byte
[
MAX_DIS_PDU_SIZE
];
byte
buffer
[]
=
new
byte
[
MAX_DIS_PDU_SIZE
];
packet
=
new
DatagramPacket
(
buffer
,
buffer
.
length
);
packet
=
new
DatagramPacket
(
buffer
,
buffer
.
length
);
...
@@ -90,6 +90,7 @@ public class DisNetworking
...
@@ -90,6 +90,7 @@ public class DisNetworking
rsocket
.
receive
(
packet
);
//blocks here waiting for next DIS pdu to be received on broadcast IP and specified port
rsocket
.
receive
(
packet
);
//blocks here waiting for next DIS pdu to be received on broadcast IP and specified port
//System.out.println("packet received from " + packet.getSocketAddress());
//System.out.println("packet received from " + packet.getSocketAddress());
rsocket
.
leaveGroup
(
group
,
findIp4Interface
());
rsocket
.
close
();
rsocket
.
close
();
rsocket
=
null
;
rsocket
=
null
;
return
new
BuffAndLength
(
packet
.
getData
(),
packet
.
getLength
());
return
new
BuffAndLength
(
packet
.
getData
(),
packet
.
getLength
());
...
...
This diff is collapsed.
Click to expand it.
src/edu/nps/moves/dis7/utilities/DisThreadedNetIF.java
+
1
−
1
View file @
9030d266
...
@@ -187,7 +187,7 @@ public class DisThreadedNetIF
...
@@ -187,7 +187,7 @@ public class DisThreadedNetIF
byte
buffer
[]
=
new
byte
[
MAX_DIS_PDU_SIZE
];
byte
buffer
[]
=
new
byte
[
MAX_DIS_PDU_SIZE
];
DatagramPacket
packet
=
new
DatagramPacket
(
buffer
,
buffer
.
length
);
DatagramPacket
packet
=
new
DatagramPacket
(
buffer
,
buffer
.
length
);
InetAddress
maddr
;
InetAddress
maddr
;
InetSocketAddress
group
;
InetSocketAddress
group
=
null
;
Pdu
pdu
;
Pdu
pdu
;
ByteBuffer
byteBuffer
;
ByteBuffer
byteBuffer
;
...
...
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