Created
October 21, 2012 09:13
-
-
Save binjoo/3926471 to your computer and use it in GitHub Desktop.
JAVA:模拟飞秋发送消息
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FeiQSocket { | |
public static void main(String[] args) throws Exception { | |
List<String> hosts = new ArrayList<String>(); | |
String host = "localhost"; //目标IP | |
int port = 2425; //目标端口,缺省为 2425 | |
InetAddress IPAddress = InetAddress.getByName(host); | |
//String str = "1_lbt4_10#32899#002481627512#0#35807#0:1:Administrators:1D46A2A23307456:288:内容"; //普通消息 | |
String str = "1_lbt4_35#128#0022680C51AC#0#35807#0:1250815230:Administrators:1D46A2A23307456:209:"; //抖屏 | |
byte[] buf = str.getBytes(); | |
DatagramPacket sendPacket = new DatagramPacket(buf, buf.length, IPAddress, port); | |
DatagramSocket sendSocket = new DatagramSocket(); | |
sendSocket.send(sendPacket); // 发送数据包 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment