Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.net.*;
- import java.io.*;
- public class Client {
- public static void main(String args[])throws Exception{
- Socket s = new Socket("localhost", 3332);
- DataInputStream din = new DataInputStream(s.getInputStream());
- DataOutputStream dout = new DataOutputStream(s.getOutputStream());
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- String str = "", str2 = "";
- while(!str.equals("stop")){
- str = br.readLine();
- dout.writeUTF(str2);
- dout.flush();
- str2 = din.readUTF();
- System.out.println("Server says: " + str2);
- }
- dout.close();
- s.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement