Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.net.*;
- import java.util.Scanner;
- public class client {
- public static void main(String[] args) {
- try{
- Socket soc=new Socket("localhost",5050);
- DataOutputStream dout=new DataOutputStream(soc.getOutputStream());
- DataInputStream din=new DataInputStream(soc.getInputStream());
- dout.writeUTF("connected");
- while (1==1){
- System.out.print(">>> ");
- Scanner scan = new Scanner(System.in);
- String number = scan.nextLine();
- String str = din.readUTF();
- System.out.println(str);
- dout.writeUTF(number);
- }
- }catch(Exception e){
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment