针对局域网IM飞秋(feiq)的开发总结
先上代码了,通过java代码群发feiq消息:
package com.triman.constant; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.net.SocketException; import java.net.UnknownHostException; import java.util.Date; public class SendFeiQ { public void sendMsgToFeiQ(String content){ DatagramSocket ds; try { ds = new DatagramSocket(); String name="投票系统管理员"; String host="triman"; long IPMSG_SENDMSG=0x00000020; byte[] buffer = ("1:" + new Date().getTime() + ":" + name + ":"+ host + ":" + IPMSG_SENDMSG + ":" + content).getBytes("gbk"); DatagramPacket dp=new DatagramPacket(buffer, buffer.length,InetAddress.getByName("192.168.100.255"),2425); ds.send(dp); ds.close(); } catch (SocketException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
相关参考资料:
1、其他文章;
http://www.cnblogs.com/vir56k/archive/2011/07/11/2103378.html
2、IPMSG协议;
http://www.blogjava.net/charles/archive/2009/05/07/269350.html
3、飞秋二次开发文档;
http://www.feiq18.com/config_nav.php?id=36
4、java网络编程;
http://sunspot.blog.51cto.com/372554/130313/