Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
socket-multithread-java-examples
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gabriele Civitarese
socket-multithread-java-examples
Commits
e92a7fe5
Commit
e92a7fe5
authored
Mar 20, 2020
by
Gabriele Civitarese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed datagram packet reading
parent
96c30153
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
UDPClient.java
udp/UDPClient.java
+1
-1
UDPServer.java
udp/UDPServer.java
+1
-1
No files found.
udp/UDPClient.java
View file @
e92a7fe5
...
@@ -35,7 +35,7 @@ class UDPClient {
...
@@ -35,7 +35,7 @@ class UDPClient {
/* Riceve il pacchetto dal server */
/* Riceve il pacchetto dal server */
clientSocket
.
receive
(
receivePacket
);
clientSocket
.
receive
(
receivePacket
);
String
modifiedSentence
=
new
String
(
receivePacket
.
getData
()
).
trim
(
);
String
modifiedSentence
=
new
String
(
receivePacket
.
getData
()
,
0
,
receivePacket
.
getLength
()
);
System
.
out
.
println
(
"FROM SERVER: "
+
modifiedSentence
);
System
.
out
.
println
(
"FROM SERVER: "
+
modifiedSentence
);
clientSocket
.
close
();
clientSocket
.
close
();
...
...
udp/UDPServer.java
View file @
e92a7fe5
...
@@ -23,7 +23,7 @@ class UDPServer {
...
@@ -23,7 +23,7 @@ class UDPServer {
/* Riceve un pacchetto da un client */
/* Riceve un pacchetto da un client */
serverSocket
.
receive
(
receivePacket
);
serverSocket
.
receive
(
receivePacket
);
String
sentence
=
new
String
(
receivePacket
.
getData
()
);
String
sentence
=
new
String
(
receivePacket
.
getData
()
,
0
,
receivePacket
.
getLength
());
/* Ottiene dal pacchetto informazioni sul mittente */
/* Ottiene dal pacchetto informazioni sul mittente */
InetAddress
IPAddress
=
receivePacket
.
getAddress
();
InetAddress
IPAddress
=
receivePacket
.
getAddress
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment