Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ChessTrack
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nicolas Federico Furquez Morena
ChessTrack
Commits
06c39701
Commit
06c39701
authored
10 years ago
by
Aylen Ricca
Browse files
Options
Downloads
Patches
Plain Diff
basic java client and server
parent
a6d6fffa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cte-serv/cliente.java
+32
-0
32 additions, 0 deletions
cte-serv/cliente.java
cte-serv/server.java
+32
-0
32 additions, 0 deletions
cte-serv/server.java
with
64 additions
and
0 deletions
cte-serv/cliente.java
0 → 100644
+
32
−
0
View file @
06c39701
import
java.io.*
;
import
java.net.*
;
class
TCPClient
{
public
static
void
main
(
String
argv
[])
throws
Exception
{
String
sentence
;
String
modifiedSentence
;
BufferedReader
inFromUser
=
new
BufferedReader
(
new
InputStreamReader
(
System
.
in
));
Socket
clientSocket
=
new
Socket
(
"192.168.1.21"
,
5555
);
DataOutputStream
outToServer
=
new
DataOutputStream
(
clientSocket
.
getOutputStream
());
BufferedReader
inFromServer
=
new
BufferedReader
(
new
InputStreamReader
(
clientSocket
.
getInputStream
()));
sentence
=
inFromUser
.
readLine
();
outToServer
.
writeBytes
(
sentence
+
'\n'
);
modifiedSentence
=
inFromServer
.
readLine
();
System
.
out
.
println
(
"FROM SERVER: "
+
modifiedSentence
);
clientSocket
.
close
();
}
}
This diff is collapsed.
Click to expand it.
cte-serv/server.java
0 → 100644
+
32
−
0
View file @
06c39701
import
java.io.*
;
import
java.net.*
;
class
TCPServer
{
public
static
void
main
(
String
argv
[])
throws
Exception
{
String
clientSentence
;
String
capitalizedSentence
;
ServerSocket
welcomeSocket
=
new
ServerSocket
(
5555
);
Socket
connectionSocket
=
welcomeSocket
.
accept
();
BufferedReader
inFromClient
=
new
BufferedReader
(
new
InputStreamReader
(
connectionSocket
.
getInputStream
()));
DataOutputStream
outToClient
=
new
DataOutputStream
(
connectionSocket
.
getOutputStream
());
while
(
true
)
{
clientSentence
=
inFromClient
.
readLine
();
//capitalizedSentence = clientSentence.toUpperCase() + '\n';
//outToClient.writeBytes(capitalizedSentence);
System
.
out
.
println
(
clientSentence
);
}
}
}
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