/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
*/
package mautcpsongsong;
import java.net.*;
import java.io.*;
import java.util.Scanner;
/**
*
* @author PTVLNE
*/
public class clientsongsong {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try{
Socket s = new Socket("127.0.0.1",7);
InputStream is = s.getInputStream();
OutputStream os = s.getOutputStream();
DataInputStream dis = new DataInputStream(is);
DataOutputStream dos = new DataOutputStream(os);
Scanner scanner = new Scanner(System.in);
while (true) {
System.out.println("Nhap du lieu");
String str = scanner.nextLine();
dos.writeUTF(str);;
String data = dis.readUTF();
System.out.println("kiem tra ket qua: "+ data);
if(str == "@"){
break;
}
}s.close();
System.out.println("Dong ket noi");
} catch (IOException ex){
System.out.println("Loi ket noi");
}
}
}