CLIENT
CLIENT:
import java.io.*;
import java.net.*;
import java.util.*;
import java.lang.String;
class MC
{
public static void main(String[] args) throws Exception
{
try
{
ServerSocket server=new ServerSocket(2812);
System.out.println("Wait connecting....");
Socket client=server.accept();
PrintWriter pw=new PrintWriter(client.getOutputStream());
BufferedReader br=new BufferedReader(new InputStreamReader(client.getInputStream()));
String st,tmp,kq;
//tmp="";
st=br.readLine();
StringBuffer temp=new StringBuffer(st);
kq=temp.reverse().toString();
/*for (int i = st.length()-1;i>=0 ;i-- )
{
tmp=tmp+st.charAt(i);
}
kq=tmp; */
pw.write(kq);
pw.write("
");
pw.flush();
br.close();
pw.close();
client.close();
}
catch (IOException evt)
{
evt.printStackTrace();
}
}
}
Bạn đang đọc truyện trên: Truyen247.Pro