Java??C#???SOCKET????????
???????????? ???????[ 2013/7/10 11:30:49 ] ????????
????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("
"?? "");
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11