J2ME如何实现CMWAP连接和CMNET连接

if(this.iConnType == Constant.CONNECTION_CMNET)//CMNET
      {
        this.httpConn = (HttpConnection)Connector.open(this.strAllAddress,Connector.READ_WRITE, true);

        ////strAllAddress = "http://ip+port+dir";
        this.httpConn.setRequestMethod(HttpConnection.POST);
        this.outputStream = this.httpConn.openOutputStream();
        this.outputStream.write(request.getContent());
        this.inputStream = this.httpConn.openInputStream();
        response = this.readResponse(this.inputStream);

        if(response == null)
        {
          // 服务器返回数据错误, 即网络IO错误
          bError = true;
        }
      }
      else // CMWAP
      {
        this.httpConn = (HttpConnection)Connector.open("http://10.0.0.172:80" +
            this.strAddress, Connector.READ_WRITE, true);
        this.httpConn.setRequestMethod(HttpConnection.POST);
        httpConn.setRequestProperty("Accept", "*/*");
        httpConn.setRequestProperty("X-Online-Host", this.strIP);

        //for example,this.strIP = "127.0.0.1:8080";
        this.outputStream = this.httpConn.openOutputStream();
        this.outputStream.write(request.getContent());
        this.inputStream = this.httpConn.openInputStream();
        response = this.readResponse(this.inputStream);

        if(response == null)
        {
          // 服务器返回数据错误, 即网络IO错误
          bError = true;
        }
      }

你可能感兴趣的:(J2ME如何实现CMWAP连接和CMNET连接)