Commit e518dcf8 authored by mrsl2000's avatar mrsl2000

ja monde bod :|

parent 16144fbc
Pipeline #700 failed with stages
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();
}
}
package network;
public class Test {
public static void main(String[] args) {
Network network = new Network();
network.send("good intellij");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment