2011-08-20 26 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

非常感謝

回答