mirror of
https://github.com/brendanhaines/RasPi.git
synced 2024-11-09 16:44:40 -07:00
23 lines
609 B
Java
23 lines
609 B
Java
|
import java.lang.*;
|
||
|
import java.io.*;
|
||
|
import java.net.*;
|
||
|
|
||
|
class Client {
|
||
|
public static void main(String args[]) {
|
||
|
try {
|
||
|
Socket skt = new Socket("192.168.42.1", 1234);
|
||
|
BufferedReader in = new BufferedReader(new
|
||
|
InputStreamReader(skt.getInputStream()));
|
||
|
System.out.print("Received string: '");
|
||
|
|
||
|
while (!in.ready()) {}
|
||
|
System.out.println(in.readLine()); // Read one line and output it
|
||
|
|
||
|
System.out.print("'\n");
|
||
|
in.close();
|
||
|
}
|
||
|
catch(Exception e) {
|
||
|
System.out.print("Whoops! It didn't work!\n");
|
||
|
}
|
||
|
}
|
||
|
}
|