added BudaClientServerStuff, an example for some client server functionality.
This commit is contained in:
29
Übung/BudaServerClientStuff/src/BudaClient.java
Normal file
29
Übung/BudaServerClientStuff/src/BudaClient.java
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
import java.io.*;
|
||||
import java.net.Socket;
|
||||
|
||||
public class BudaClient {
|
||||
public static void main(String[] args) {
|
||||
Socket sock = null;
|
||||
try {
|
||||
sock = new Socket("localhost", 8090);
|
||||
OutputStream out= sock.getOutputStream();
|
||||
BufferedReader conin = new BufferedReader(new InputStreamReader(System.in));
|
||||
String line = "";
|
||||
while (true) {
|
||||
line = conin.readLine();
|
||||
out.write(line.getBytes());
|
||||
if (line.equalsIgnoreCase("Quitx")) {
|
||||
break;
|
||||
}
|
||||
//line.startsWith() //todo: automatically handle name lengths
|
||||
//TODO: Implement inputStream in.
|
||||
}
|
||||
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user