コード例 #1
0
  //	@PostConstruct
  public void receiveSms() throws IOException, ClassNotFoundException {
    String hostIp = InetAddress.getLocalHost().getHostAddress();
    System.out.println(hostIp);

    SGIPServerInitInfo info = new SGIPServerInitInfo();
    info.IP = hostIp;
    info.port = 8801; // 本机监听端口,默认8801
    info.userName = this.userName;
    info.passWord = this.passWord;

    SGIPServer server = SGIPServer.getInstance();
    server.init(info);
    server.start();

    // 启动短信接收线程
    Thread recThread = new Thread(this);
    recThread.start();
  }