随笔 - 1, 文章 - 2, 评论 - 0, 引用 - 0
数据加载中……

2010年10月14日

Java Socket 服务器端示例代码

ServerSocket ss = new ServerSocket(9999);
Socket socket = ss.accept();
InputStreamReader isReader = new InputStreamReader(socket.getInputStream());
BufferedReader reader = new BufferedReader(isReader);
StringBuffer sb = new StringBuffer();
String line;
while((line=reader.readLine())!=null){
          sb.append(line);
}
FileWriter fos = new FileWriter("d:/aa.txt",true);
fos.write(sb.toString());
fos.write("\r\n");
fos.close();
socket.close();
ss.close();
out.print(sb.toString()+"<br/>");

posted @ 2010-10-15 09:00 温凯旋 阅读(104) | 评论 (0)编辑 收藏

Java Socket 客户端示例代码

客户端代码
Socket socket = new Socket("127.0.0.1",9999);
OutputStreamWriter osWriter = new OutputStreamWriter(socket.getOutputStream());
BufferedWriter writer = new BufferedWriter(osWriter);
double b = Math.random()*10000;
writer.write("发动内容" + b);
writer.close();
socket.close();

posted @ 2010-10-15 08:52 温凯旋 阅读(92) | 评论 (0)编辑 收藏

去除桌面右键多余菜单.cmd

把以下内容粘贴到txt文本文件中

regsvr32 /u /s igfxpph.dll
reg delete HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers /f
reg add HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\new /ve /d {D969A300-E7FF-11d0-A93B-00A0C90F2719}
reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v HotKeysCmds /f
reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v IgfxTray /f

然后把该txt文本文件后缀名修改为cmd,双击运行即可。



posted @ 2010-10-14 23:28 温凯旋 阅读(377) | 评论 (0)编辑 收藏