登录
首页 » Java » IPC

IPC

于 2012-07-12 发布 文件大小:44KB
0 164
下载积分: 1 下载次数: 11

代码说明:

  安卓系统中进程通信的例程,利用IPC机制进行服务端与客户端的进程通信(Andrews in the process of communication routines, the use of the IPC mechanism to carry out the process of communication services and the clients)

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 谱聚类
    这是一种利用高效的迭代 Lanczos eigensolver 的谱聚类算法演示。
    2022-06-21 00:01:30下载
    积分:1
  • FingerPaint
    说明:  使用android手机系统实现的手绘功能(Implementation of the system using android phone features hand-painted)
    2011-03-29 08:34:26下载
    积分:1
  • Chikat-9.4.1 Windows 32bit 示例代码
    Chikat-9.4.1  Windows 32bit 示例代码 Java POP3/SMTP email library. SMTP client for sending email. POP3 client for reading email. Works with Exchange Server (all versions) Works with all POP3 / SMTP servers Supports POP3 and SMTP SSL/TLS connections.
    2022-02-12 17:56:14下载
    积分:1
  • 软件设计实现代码
    资源描述 创建型 1. Factory Method(工厂方法) 2. Abstract Factory(抽象工厂) 3. Builder(建造者) 4. Prototype(原型) 5. Singleton(单例) 结构型 6. Adapter Class/Object(适配器) 7. Bridge(桥接) 8. Composite(组合) 9. Decorator(装饰) 10. Facade(外观) 11. Flyweight(享元) 12. Proxy(代理) 行为型 13. Interpreter(解释器) 14. Template Method(模板方法)
    2022-03-19 05:33:10下载
    积分:1
  • 下拉列表Spinner入门级示例代码
    非常入门级的示例,适合新手
    2015-04-25下载
    积分:1
  • 微信公众平台模式(JAVA) SDK/微信app
    【核心代码】package com.gson;import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.IOException;import java.lang.reflect.Field;import java.lang.reflect.Method;import java.util.Date;import java.util.Properties;import javax.servlet.Filter;import javax.servlet.FilterChain;import javax.servlet.FilterConfig;import javax.servlet.ServletException;import javax.servlet.ServletInputStream;import javax.servlet.ServletRequest;import javax.servlet.ServletResponse;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.apache.log4j.Logger;import com.gson.bean.Articles;import com.gson.bean.InMessage;import com.gson.bean.OutMessage;import com.gson.bean.TextOutMessage;import com.gson.inf.MessageProcessingHandler;import com.gson.util.Tools;import com.gson.util.XStreamFactory;import com.thoughtworks.xstream.XStream;/** * 请求拦截 * * @author GodSon * */public class WeChatFilter implements Filter { private final Logger logger = Logger.getLogger(WeChatFilter.class); private String _token; private String conf = "classPath:wechat.properties"; private String defaultHandler = "com.gson.inf.DefaultMessageProcessingHandlerImpl"; private Properties p; @Override public void destroy() { logger.info("WeChatFilter已经销毁"); } @Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) res; Boolean isGet = request.getMethod().equals("GET"); String path = request.getServletPath(); String pathInfo = path.substring(path.lastIndexOf("/")); if (pathInfo == null) { response.getWriter().write("error"); } else { _token = pathInfo.substring(1); if (isGet) { doGet(request, response); } else { doPost(request, response); } } } private void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { response.setCharacterEncoding("UTF-8"); response.setContentType("text/xml"); OutMessage oms = new OutMessage(); ServletInputStream in = request.getInputStream(); // 转换微信post过来的xml内容 XStream xs = XStreamFactory.init(false); xs.alias("xml", InMessage.class); String xmlMsg = Tools.inputStream2String(in); logger.debug("输入消息:[" xmlMsg "]"); InMessage msg = (InMessage) xs.fromXML(xmlMsg); // 获取自定消息处理器,如果自定义处理器则使用默认处理器。 String handler = p.getProperty("MessageProcessingHandlerImpl"); if (handler == null) handler = defaultHandler; try { // 加载处理器 Class clazz = Class.forName(handler); MessageProcessingHandler processingHandler = (MessageProcessingHandler) clazz.newInstance(); // 取得消息类型 String type = msg.getMsgType(); Method mt = clazz.getMethod(type "TypeMsg", InMessage.class); oms = (OutMessage) mt.invoke(processingHandler, msg); if (oms == null) { oms = new TextOutMessage(); ((TextOutMessage) oms).setContent("系统错误!"); } setMsgInfo(oms,msg); } catch (Exception e) { logger.error(e); oms = new TextOutMessage(); ((TextOutMessage) oms).setContent("系统错误!"); try { setMsgInfo(oms,msg); } catch (Exception e1) { logger.error(e); } } // 把发送发送对象转换为xml输出 xs = XStreamFactory.init(true); xs.alias("xml", oms.getClass()); xs.alias("item", Articles.class); String xml = xs.toXML(oms); logger.debug("输出消息:[" xml "]"); response.getWriter().write(xml); } private void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { String signature = request.getParameter("signature");// 微信加密签名 String timestamp = request.getParameter("timestamp");// 时间戳 String nonce = request.getParameter("nonce");// 随机数 String echostr = request.getParameter("echostr");// // 验证 if (Tools.checkSignature(_token, signature, timestamp, nonce)) { response.getWriter().write(echostr); } } private void setMsgInfo(OutMessage oms,InMessage msg) throws Exception { // 设置发送信息 Class outMsg = oms.getClass().getSuperclass(); Field CreateTime = outMsg.getDeclaredField("CreateTime"); Field ToUserName = outMsg.getDeclaredField("ToUserName"); Field FromUserName = outMsg.getDeclaredField("FromUserName"); ToUserName.setAccessible(true); CreateTime.setAccessible(true); FromUserName.setAccessible(true); CreateTime.set(oms, new Date().getTime()); ToUserName.set(oms, msg.getFromUserName()); FromUserName.set(oms, msg.getToUserName()); } /** * 启动的时候加载wechat.properties配置 可以在过滤器配置wechat.properties路径 */ @Override public void init(FilterConfig config) throws ServletException { String cf = config.getInitParameter("conf"); if (cf != null) { conf = cf; } String classPath = this.getClass().getResource("/").getPath().replaceAll("%20", " "); conf = conf.replace("classPath:", classPath); p = new Properties(); File pfile = new File(conf); if (pfile.exists()) { try { p.load(new FileInputStream(pfile)); } catch (FileNotFoundException e) { logger.error("未找到wechat.properties", e); } catch (IOException e) { logger.error("wechat.properties读取异常", e); } } logger.info("WeChatFilter已经启动!"); }}
    2014-01-21下载
    积分:1
  • ssh雪精灵简单图书管理系统
    这个源码是雪精灵开发的零配置图书管理系统,基本功能齐全,对于初学者有较大好处。 公司一直不是ssh零配置的框架,每次写action都要在applicationcontext和struts里面配置,好麻烦,最近有空,写了一个ssh零配置的框架 这里写了一个小的项目,以用户权限管理为例 先做准备工作: 1.struts2去官网下载最新版的str
    2022-05-24 22:58:28下载
    积分:1
  • android Websocket
    android Websocket 通讯编程,可以掩码解析,报文发送,websocket通讯超时处理,可以自动计算报文长度。
    2022-03-21 02:28:32下载
    积分:1
  • 工资单系统 JAVA
    工资管理系统是一个非常受欢迎的系统,因为那是一个系统,让你(管理员)来计算你的员工的薪水。简单易懂。这是一个JAVA基本程序,每一个初学者一定会很容易理解。注意:使用Java程序运行的程序〜
    2022-12-31 08:30:03下载
    积分:1
  • snmp4j初学代码
    简单的连接snmp agent 然后get数据 在main函数中 Address targetAddress=GenericAddress.parse("udp:192.168.5.151/161");   TransportMapping transport=new DefaultUdpTransportMapping();   Snmp snmp=new Snmp(transport);   transport.listen();   CommunityTarget target=new CommunityTarget();   target.setCommunity(new OctetString("WinSpread"));   target.setAddress(targetAddress);   target.setRetries(3);   target.setTimeout(5000);   target.setVersion(1);   PDU request=new PDU();   request.setType(PDU.SET); //  request.add(new VariableBinding(new OID("IP-FORWARD-MIB::inetCidrRouteMetric4.ipv4"))); //  request.add(new VariableBinding(new OID("IP-MIB::ipAdEntAddr"))); //  request.add(new VariableBinding(new OID(".1.3.6.1.2.1.1.3.0"))); //  
    2022-04-07 20:38:13下载
    积分:1
  • 696516资源总数
  • 106409会员总数
  • 8今日下载