Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.net.*;
- import java.io.*;
- public class Server {
- public static void main(String args[])throws Exception{
- ServerSocket ss = new ServerSocket(3332);
- Socket s = ss.accept();
- 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 = din.readUTF();
- System.out.println("Client says: " + str);
- str2 = br.readLine();
- dout.writeUTF(str2);
- dout.flush();
- }
- din.close();
- s.close();
- ss.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement