Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package f2015.ex2;
- import java.io.*;
- import java.net.Socket;
- import java.util.Scanner;
- public class Client {
- public static void main(String[] args) {
- try {
- Socket s = new Socket("127.0.0.1", 8080);
- Scanner scanner = new Scanner(System.in);
- InputStream is = s.getInputStream();
- InputStreamReader isr = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(isr);
- OutputStream os = s.getOutputStream();
- PrintWriter pw = new PrintWriter(os, true);
- while (true) {
- String req = scanner.nextLine();
- pw.println(req);
- if(!req.contains(":"))
- System.out.println(br.readLine());
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement