public class SocketClient extends Thread{
public SocketClient(){
this.run();
}
public void run(){
try {
Socket client = new Socket("WEBSEITE.de", 80);
System.out.println("Client Gestartet");
OutputStream outputStream = client.getOutputStream();
PrintWriter printWriter = new PrintWriter(outputStream, true);
InputStream inputStream = client.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
printWriter.write("test");
printWriter.flush();
String s = null;
while((s = reader.readLine()) != null){
System.out.println(s);
}
reader.close();
printWriter.close();
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}