????java??C#???SOCKET????????

???????????????????java??д??

/**
* ??????????????
*
*/
private static void socketService()
{
ExecutorService exec = Executors.newCachedThreadPool();
try
{
ServerSocket server=new ServerSocket(5678);
int i = 1;
while(true)
{
MyLogManager.InfoLog(log?? null??"????????"+i+"?????...");
try
{
Socket client=server.accept();
MyLogManager.InfoLog(log?? null??"??"+i+"????????????!");
exec.execute(new PDAServerWithDB(client));
}
catch(Exception whileExp)
{
String msg = "????????????????";
MyLogManager.ErrorLog(log?? whileExp?? msg);
}
i++;
}
}
catch(IOException ioe)
{
String msg = "????????";
MyLogManager.ErrorLog(log?? ioe?? msg);
exec.shutdown();
}
}

???????????Socket??????????????PDAServerWithDB???д???

???????????????????????????????

??????????????????????ReadLine()?????????????????????????????н???????

??????????????????????????

????a)?????????????

InputStream inPut = s.getInputStream();
OutputStream outPut = s.getOutputStream();
PrintWriter outWriter=new PrintWriter(outPut);
BufferedReader inputReader =new BufferedReader(new InputStreamReader(inPut));

????b)????????????????

String request = inputReader.readLine();
request = request.trim();
request = request.replaceAll(" "?? "");