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

📄 c.java

📁 microtik tool to vie another router in a network
💻 JAVA
字号:
package com.hoya.client;

import com.hoya.games.common.a;
import com.hoya.games.sp.lx;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Date;
import java.util.Vector;

public abstract class c extends Thread
{
  public String a;
  public int b;
  e c;
  public String o = "";
  public String p = "";
  public int q = 0;
  protected Vector d;
  protected Vector e;
  protected String f;
  public boolean g = false;
  public boolean h = false;
  public boolean i = false;
  public boolean j = false;
  protected boolean k = true;
  protected String l = "";
  Socket m = null;

  public final void d()
  {
    this.d = new Vector();
    this.e = new Vector();
    a("try connecting to " + this.a + ":" + this.b);
    if (!(e()))
      return;
    InputStream localInputStream = null;
    OutputStream localOutputStream = null;
    try
    {
      localInputStream = this.m.getInputStream();
      a("getInputStream");
      localOutputStream = this.m.getOutputStream();
      a("getOutputStream");
    }
    catch (IOException localIOException)
    {
    }
    new a(this, localInputStream);
    this.c = new e(localOutputStream);
  }

  public void run()
  {
    if (this.g)
    {
      a(20L);
      while (true)
        do
        {
          if (!(this.k))
            return;
          a();
          a(50L);
        }
        while (!(this.i));
    }
  }

  public abstract String b();

  public abstract com.hoya.games.common.a c();

  private void a()
  {
    while (this.e.size() > 0)
    {
      com.hoya.games.common.a locala = (com.hoya.games.common.a)this.e.remove(0);
      a(locala);
    }
  }

  protected final boolean e()
  {
    a("in connect()");
    try
    {
      this.m = new Socket(this.a, this.b);
      this.m.setTcpNoDelay(false);
      a("connected...\nlocal:" + this.m.getLocalAddress() + ":" + this.m.getLocalPort() + ", hostname:" + this.m.getLocalAddress().getHostName() + "\nremote:" + this.m.getInetAddress().getHostAddress() + ":" + this.m.getPort());
      this.o = this.m.getLocalAddress().getHostAddress();
      this.p = this.m.getLocalAddress().getHostName();
      this.q = this.m.getLocalPort();
      if (this.o == null)
        this.o = "";
      if (this.p == null)
        this.p = "";
      this.g = true;
      return true;
    }
    catch (UnknownHostException localUnknownHostException)
    {
      c("UnknownHostException: " + localUnknownHostException.getMessage());
      this.j = true;
      return false;
    }
    catch (Exception localException)
    {
      c("Exception while connecting:" + localException);
      localException.printStackTrace();
      this.j = true;
      return false;
    }
  }

  public final void h()
  {
    a("in echoback(),time:" + new Date());
    com.hoya.games.common.a locala = a(1097);
    a(locala);
  }

  public final void b(String paramString1, String paramString2)
  {
    com.hoya.games.common.a locala;
    (locala = new com.hoya.games.common.a(1000)).b(b());
    this.l = paramString1;
    locala.c(paramString1);
    locala.d(paramString2);
    a(locala);
  }

  public final void a(String paramString1, String paramString2)
  {
    com.hoya.games.common.a locala;
    (locala = c()).b(b());
    this.l = paramString1;
    locala.c(paramString1);
    locala.d(paramString2);
    a(locala);
  }

  public final com.hoya.games.common.a a(int paramInt)
  {
    com.hoya.games.common.a locala;
    (locala = new com.hoya.games.common.a(paramInt, this.f, this.l)).b(b());
    return locala;
  }

  public final void f()
  {
    b("STOP client ,isAlive:" + isAlive());
    this.k = false;
    this.g = false;
    try
    {
      this.m.close();
      return;
    }
    catch (Exception localException)
    {
    }
  }

  protected final void a(com.hoya.games.common.a parama)
  {
    parama.b(b());
    parama.c(this.l);
    this.c.a(parama);
  }

  private static void a(long paramLong)
  {
    try
    {
      Thread.sleep(paramLong);
      return;
    }
    catch (InterruptedException localInterruptedException)
    {
    }
  }

  public final void g()
  {
    this.h = true;
    this.g = false;
    this.i = false;
  }

  public static void a(String paramString)
  {
    if (lx.aJ)
      System.out.println(paramString);
  }

  public static void b(String paramString)
  {
    if (lx.aJ)
      System.out.println(paramString);
  }

  public static void c(String paramString)
  {
    if (lx.aJ)
      System.out.println(paramString);
  }
}

⌨️ 快捷键说明

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