Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
lab11
Project
Project
Details
Activity
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
mrsl2000
lab11
Commits
e518dcf8
Commit
e518dcf8
authored
Jun 09, 2019
by
mrsl2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ja monde bod :|
parent
16144fbc
Pipeline
#700
failed with stages
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
Network.java
src/network/Network.java
+37
-0
Test.java
src/network/Test.java
+8
-0
No files found.
src/network/Network.java
0 → 100644
View file @
e518dcf8
package
network
;
import
java.io.*
;
import
java.net.InetAddress
;
import
java.net.Socket
;
import
java.net.UnknownHostException
;
import
java.util.Scanner
;
public
class
Network
{
Socket
socket
;
InetAddress
address
=
null
;
public
Network
(){
try
{
address
=
InetAddress
.
getByName
(
"localhost"
);
}
catch
(
UnknownHostException
e
)
{
e
.
printStackTrace
();
}
try
{
socket
=
new
Socket
(
address
,
1234
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
public
void
send
(
String
m
){
try
{
PrintStream
print
=
new
PrintStream
(
socket
.
getOutputStream
());
print
.
println
(
m
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
public
String
receive
()
throws
IOException
{
Scanner
scanner
=
new
Scanner
(
socket
.
getInputStream
());
return
scanner
.
next
();
}
}
src/network/Test.java
0 → 100644
View file @
e518dcf8
package
network
;
public
class
Test
{
public
static
void
main
(
String
[]
args
)
{
Network
network
=
new
Network
();
network
.
send
(
"good intellij"
);
}
}
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