Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User hunter_tai's Avatar
    Join Date
    Apr 2006
    Posts
    5
    我写的一个联网的应用,没用什么特殊的代码,,在模拟器上运行正常,可是在真机上连接的时候总是抛出io异常,显示的错误内容是Error in HTTP operation
    以下是的我的代码谁能帮我看看呀!另外6255上也有同样的问题!!!
    private void createLink(String URLs) throws DDR_Exception
    {
    try
    {
    c=(HttpConnection)Connector.open(URLs,Connector.READ,true);
    }
    catch(SecurityException e)
    {
    }
    catch(IllegalArgumentException e)
    {
    }
    catch(ConnectionNotFoundException e)
    {
    }
    catch(IOException e)
    {
    }
    }
    private void openStream() throws DDR_Exception
    {
    try
    {
    //is = c.openDataInputStream();
    is = new DataInputStream(c.openInputStream());这个时候抛出的
    }
    catch(IllegalArgumentException e)
    {
    ……
    }
    private void streamReader() throws DDR_Exception
    {
    try
    {
    baos = new ByteArrayOutputStream();
    int ch = 0;
    while ((ch = is.read())!= -1&&stats==0)
    {
    baos.write(ch);
    }
    data = baos.toByteArray();
    }
    catch(IOException e)
    {
    }
    }
    public void linkCall(String URLs) throws DDR_Exception
    {
    try
    {
    createLink(URLs);
    openStream();
    streamReader();
    baos.close();
    baos = null;
    is.close();
    is=null;
    c.close();
    c=null;
    }
    catch(IOException e)
    {

    }
    finally
    {
    closeLink();
    }
    }
    Last edited by hunter_tai; 2006-06-02 at 07:08.

  2. #2
    Registered User hunter_tai's Avatar
    Join Date
    Apr 2006
    Posts
    5
    还有一个问题,在6235、6255上不能调用getResponseCode()的方法的话,应该怎么判断是否连接成功,谢谢
    Last edited by hunter_tai; 2006-06-02 at 07:08.

  3. #3
    Regular Contributor Steven_Ch's Avatar
    Join Date
    Mar 2003
    Location
    Beijing/China
    Posts
    153
    打开输入流成功就说明连接成功了。
    这两个手机都是S40 2nd么?
    我想你需要在代码中设置代理。

  4. #4
    Registered User hunter_tai's Avatar
    Join Date
    Apr 2006
    Posts
    5
    Quote Originally Posted by Steven_Ch
    打开输入流成功就说明连接成功了。
    这两个手机都是S40 2nd么?
    我想你需要在代码中设置代理。
    可是在联通的网络上根本不用设置代理呀。

  5. #5
    Registered User lhz0123's Avatar
    Join Date
    Jun 2006
    Posts
    3
    Error in HTTP operation这个异常应该是网络没有通

  6. #6
    Regular Contributor Steven_Ch's Avatar
    Join Date
    Mar 2003
    Location
    Beijing/China
    Posts
    153
    联通的网络我就不知道了,基本上这个是否加代理是跟着接入点走的,应该只有cmwap需要使用

  7. #7
    Regular Contributor steven2ffff's Avatar
    Join Date
    Jun 2003
    Posts
    73
    cdma上可以自由下kajva软件?以为是被神奇宝典垄断了呢

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved