⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sendthread.java

📁 短信平台CMPP30 的JAVA程序,(含SQL数据库)
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   SendThread.java

package com.SGIP12.sgiputil;

import com.SGIP12.sgipdata.*;
import com.log.CTime;
import java.io.*;
import java.net.Socket;
import java.net.SocketException;
import javax.swing.JTextArea;

// Referenced classes of package com.SGIP12.sgiputil:
//            SGIPPacket, SlideWindowData, SGIPConfig, SGIPLog, 
//            SGIPQueue, SlideWindow

public class SendThread extends Thread
{

    private long SPNum;
    private UnbindResp Unresp;
    private Bind active;
    public boolean bindFailed;
    private int bindTimes;
    private byte byte_content[];
    private Bind command;
    private Deliver deliver;
    private int destroy;
    private String host;
    private int initTimes;
    private InputStream input;
    private String logFile;
    private String loginName;
    private String loginPwd;
    private int loginType;
    private OutputStream out;
    private SGIPPacket packet;
    private JTextArea packetArea;
    private int port;
    private SGIPQueue recvQueue;
    private BindResp resp;
    private boolean running;
    private SGIPQueue sendQueue;
    private SGIP_Command sgip;
    private SGIPConfig sgipConfig;
    private SGIPLog sgipSendLog;
    private SlideWindow slideWindow;
    private SlideWindowData slideWindowData;
    private Socket so;
    private JTextArea stateArea;
    private boolean stopFlag;
    private Submit submit;
    private SubmitResp submitresp;
    private Unbind term;
    private SGIP_Command tmp;
    private Trace tr;
    private TraceResp trResp;

    public SendThread(SGIPConfig conf, SGIPQueue sendQ, SGIPQueue recvQ, SlideWindow slideW)
    {
        bindFailed = false;
        so = null;
        out = null;
        input = null;
        command = null;
        sgip = null;
        tmp = null;
        byte_content = null;
        deliver = null;
        submit = null;
        submitresp = null;
        active = null;
        term = null;
        resp = null;
        Unresp = null;
        tr = null;
        trResp = null;
        stateArea = null;
        packetArea = null;
        running = true;
        stopFlag = false;
        destroy = 0;
        initTimes = 0;
        bindTimes = 0;
        logFile = "Send";
        sgipConfig = conf;
        host = sgipConfig.getGateWayHost();
        port = sgipConfig.getGateWayPort();
        SPNum = sgipConfig.getNodeID();
        loginName = sgipConfig.getGateWayUser();
        loginPwd = sgipConfig.getGateWayPwd();
        sendQueue = sendQ;
        recvQueue = recvQ;
        slideWindow = slideW;
        if(stateArea != null)
            stateArea.append(CTime.getStringDate() + " SGIP12模块客户端正在启动!\n\n");
    }

    public void Exit()
    {
        running = false;
    }

    public void ReWork()
    {
        stopFlag = false;
    }

    public void SetTextArea(JTextArea sa, JTextArea pa)
    {
        stateArea = sa;
        packetArea = pa;
    }

    public void StopWork()
    {
        if(stateArea != null)
            stateArea.append(CTime.getStringDate() + " SGIP12模块客户端停止!\n\n");
        stopFlag = true;
    }

    public int getDestroy()
    {
        return destroy;
    }

    public void run()
    {
        int i = 0;
        int errNum = 0;
          goto _L1
_L7:
        if(!stopFlag)
            break MISSING_BLOCK_LABEL_93;
        if(so != null)
            so.close();
        Thread.sleep(1000L);
        try
        {
            Thread.sleep(10L);
            if(so != null)
                so.close();
        }
        catch(Exception s)
        {
            SGIPLog.WriteLog(-2, s.toString(), logFile);
            System.out.println(s.toString());
        }
        continue; /* Loop/switch isn't completed */
        System.out.println("Number of elements in MT Queue: " + sendQueue.size());
        if(sendQueue.size() != 0)
            break MISSING_BLOCK_LABEL_1741;
        bindTimes++;
        if(bindTimes != 1)
            break MISSING_BLOCK_LABEL_1677;
        so = new Socket(host, port);
        out = new DataOutputStream(so.getOutputStream());
        input = new DataInputStream(so.getInputStream());
        break MISSING_BLOCK_LABEL_357;
        SocketException se;
        se;
        bindFailed = true;
        SGIPLog.WriteLog(-2, "Socket Error: " + se.toString(), logFile);
        if(stateArea != null)
            stateArea.append(CTime.getStringDate() + " SGIP12模块客户端初始化失败!\n");
        bindTimes = 0;
        Thread.sleep(5000L);
        try
        {
            Thread.sleep(10L);
            if(so != null)
                so.close();
        }
        catch(Exception s)
        {
            SGIPLog.WriteLog(-2, s.toString(), logFile);
            System.out.println(s.toString());
        }
        continue; /* Loop/switch isn't completed */
        sgip = new SGIP_Command();
        if(stateArea != null && bindTimes == 1)
            stateArea.append(CTime.getStringDate() + " SGIP12模块客户端初始化成功.\n\n");
        Bind bindTest = new Bind(SPNum, 1, loginName, loginPwd);
        if(bindTest.write(out) == 0)
        {
            if(packetArea != null)
            {
                packetArea.append(CTime.getStringDate() + "--SGIP12--Bind: (SP->SMG)\n");
                packetArea.append("TotalLength: " + bindTest.getTotalLength() + "\n");
                packetArea.append("CommandID: " + bindTest.getCommandID() + "\n");
                packetArea.append("SequenceID_1: " + bindTest.getSeqno_1() + "\n");
                packetArea.append("SequenceID_2: " + bindTest.getSeqno_2() + "\n");
                packetArea.append("SequenceID_3: " + bindTest.getSeqno_3() + "\n");
                packetArea.append("LoginType: " + bindTest.GetLoginType() + "\n");
                packetArea.append("LoginName: " + bindTest.GetLoginName() + "\n");
                packetArea.append("LoginPassword: " + bindTest.GetLoginPassword() + "\n\n");
            }
            SGIP_Command tmpTest = sgip.read(input);
            if(sgip.getCommandID() == 0x80000001)
            {
                BindResp bindResp = (BindResp)tmpTest;
                bindResp.readbody();
                if(packetArea != null)
                {
                    packetArea.append(CTime.getStringDate() + "--SGIP12--BindResp: (SMG->SP)\n");
                    packetArea.append("TotalLength: " + bindResp.getTotalLength() + "\n");
                    packetArea.append("CommandID: " + bindResp.getCommandID() + "\n");
                    packetArea.append("SequenceID_1: " + bindResp.getSeqno_1() + "\n");
                    packetArea.append("SequenceID_2: " + bindResp.getSeqno_2() + "\n");
                    packetArea.append("SequenceID_3: " + bindResp.getSeqno_3() + "\n");
                    packetArea.append("Result: " + bindResp.GetResult() + "\n\n");
                }
                int bindRst = bindResp.GetResult();
                if(bindRst == 0)
                {
                    stateArea.append(CTime.getStringDate() + " SGIP12模块客户端连接成功!\n\n");
                } else
                {
                    bindTimes = 0;
                    stateArea.append(CTime.getStringDate() + " SGIP12模块客户端连接失败!\n\n");
                }
            } else
            {
                bindTimes = 0;
                stateArea.append(CTime.getStringDate() + " SGIP12模块客户端连接失败!\n\n");
            }
        } else
        {
            bindTimes = 0;
            stateArea.append(CTime.getStringDate() + " SGIP12模块客户端连接失败!\n\n");
        }
        Unbind unBind = new Unbind(SPNum);
        if(unBind.write(out) == 0)
        {
            if(packetArea != null)
            {
                packetArea.append(CTime.getStringDate() + "--SGIP12--Unbind: (SP->SMG)\n");
                packetArea.append("TotalLength: " + unBind.getTotalLength() + "\n");
                packetArea.append("CommandID: " + unBind.getCommandID() + "\n");
                packetArea.append("SequenceID_1: " + unBind.getSeqno_1() + "\n");
                packetArea.append("SequenceID_2: " + unBind.getSeqno_2() + "\n");
                packetArea.append("SequenceID_3: " + unBind.getSeqno_3() + "\n\n");
            }
            SGIP_Command temUnbind = sgip.read(input);
            if(temUnbind.getCommandID() == 0x80000002)
            {
                UnbindResp unBindResp = (UnbindResp)temUnbind;
                if(packetArea != null)
                {
                    packetArea.append(CTime.getStringDate() + "--SGIP12--UnbindResp: (SMG->SP)\n");
                    packetArea.append("TotalLength: " + unBindResp.getTotalLength() + "\n");
                    packetArea.append("CommandID: " + unBindResp.getCommandID() + "\n");
                    packetArea.append("SequenceID_1: " + unBindResp.getSeqno_1() + "\n");
                    packetArea.append("SequenceID_2: " + unBindResp.getSeqno_2() + "\n");
                    packetArea.append("SequenceID_3: " + unBindResp.getSeqno_3() + "\n\n");
                }
                so.close();
            }
        }
        Thread.sleep(1000L);
        try
        {
            Thread.sleep(10L);
            if(so != null)
                so.close();
        }
        catch(Exception s)
        {
            SGIPLog.WriteLog(-2, s.toString(), logFile);
            System.out.println(s.toString());
        }
        continue; /* Loop/switch isn't completed */
        System.out.println("host: " + host + " port: " + port + " LoginName: " + loginName + " LonginPwd: " + loginPwd);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -