first commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
|
||||
class ClientExample {
|
||||
public static final int PORT = 1234;
|
||||
|
||||
public static void main(String argv[]) {
|
||||
try {
|
||||
Socket s = new Socket("localhost", PORT);
|
||||
BufferedReader br = new BufferedReader(new
|
||||
InputStreamReader(s.getInputStream()));
|
||||
PrintWriter pr = new PrintWriter(new
|
||||
OutputStreamWriter(s.getOutputStream()));
|
||||
|
||||
System.out.println(s.getLocalAddress().toString());
|
||||
System.out.println(s.getLocalSocketAddress().toString());
|
||||
pr.println("Hello, world!");
|
||||
pr.flush();
|
||||
System.out.println(br.readLine());
|
||||
} catch (IOException e) {
|
||||
System.out.println("IO Exception: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user