2011-08-20 51 views
0

发送响应从J2ME的HttpRequest,我使用这个代码J2ME发送的HttpRequest到asp.net后端从ASP.NET

HttpConnection connection = null; 
    byte responseData[] = null; 
    try { 
     connection = (HttpConnection) new ConnectionFactory() 
       .getConnection(URL).getConnection(); 
     int len = (int) connection.getLength(); 
     if (len != -1) { 
      responseData = new byte[len]; 
      DataInputStream dis; 
      dis = new DataInputStream(connection.openInputStream()); 
      dis.readFully(responseData); 
     } 
    } catch (Exception e) { 

    } 

    final byte[] responseDataToProcess = responseData; 

,并在asp.net我使用这个代码,以响应

protected void Page_Load(object sender, EventArgs e) 
{ 
//processes 
Response.Write("true"); 
} 

的问题是在客户端接收无响应和响应的 “len” 的= -1

非常感谢

回答