BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 02-24-2005, 04:17 PM   #1
jwall1701
New Member
 
Join Date: Feb 2005
Posts: 1
Default Malformed Address Exception when doing TCP

Please Login to Remove!

I'm using a 7100t (OS 3.8) from T-Mobile.

I'm trying to write my own MIDlet application that uses TCP instead of the MDS to access web content. To make sure I'm using TCP and not the MDS I am using the ";deviceside=true" flag appended to the URL. This works about 50% of the time. When the application fails it returns an exception that says:

"Malformed Address. Returning null connection"

However, when I change the "deviceside" flag in the URL from "true" to "false" so I can go through the MDS it runs perfectly 100% of the time.

Any tips or ideas on what could be causing this will be greatly appreciated.

Thank you kindly,
Jeremy

Code:
package NetTest;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.io.*;
import java.io.*;

public class NetTestMIDlet extends MIDlet implements CommandListener
xxx123;
    private Command cmdExit = null;
    private Command cmdHTTP = null;
    private Form frmMain = null;
    
    public NetTestMIDletxxx40;xxx41;
    xxx123;
        cmdExit = new Commandxxx40;"Exit", Command.EXIT, 1xxx41;;
        cmdHTTP = new Commandxxx40;"Exec HTTP", Command.ITEM, 2xxx41;;
        frmMain = new Formxxx40;"NetTest"xxx41;;
        frmMain.addCommandxxx40;cmdExitxxx41;;
        frmMain.addCommandxxx40;cmdHTTPxxx41;;
        frmMain.setCommandListenerxxx40;thisxxx41;;
    xxx125;
    
    public void startAppxxx40;xxx41;
    xxx123;
        Display.getDisplayxxx40;thisxxx41;.setCurrentxxx40;frmMainxxx41;;
    xxx125;
    
    public void pauseAppxxx40;xxx41;
    xxx123;
    xxx125;
    
    public void destroyAppxxx40;boolean unconditionalxxx41;
    xxx123;
    xxx125;
    
    public void commandActionxxx40;Command c, Displayable dxxx41;
    xxx123;
        ifxxx40;c == cmdExitxxx41;
        xxx123;
            destroyAppxxx40;falsexxx41;;
            notifyDestroyedxxx40;xxx41;;
        xxx125;
        else ifxxx40;c == cmdHTTPxxx41;
        xxx123;
            frmMain.deleteAllxxx40;xxx41;;
            execHTTPxxx40;xxx41;;
        xxx125;
    xxx125;
    
    private void execHTTPxxx40;xxx41;
    xxx123;
        new Threadxxx40;new Fetcherxxx40;xxx41;xxx41;.startxxx40;xxx41;;        
    xxx125;
    
    private class Fetcher implements Runnable
    xxx123;
        public void runxxx40;xxx41;
        xxx123;    
            frmMain.appendxxx40;"Begin Exec HTTP\n"xxx41;;
            try
            xxx123;
                HttpConnection conn = xxx40;HttpConnectionxxx41; Connector.openxxx40;"httpxxx58;//www.jeremywall.com/;deviceside=true"xxx41;;
                ifxxx40;conn == nullxxx41;
                xxx123;
                    frmMain.appendxxx40;"HttpConnection is null\n"xxx41;;
                xxx125;
                else
                xxx123;
                    frmMain.appendxxx40;"Resp Codexxx58; " + conn.getResponseCodexxx40;xxx41; + "\n"xxx41;;
                    frmMain.appendxxx40;"Resp Msgxxx58; " + conn.getResponseMessagexxx40;xxx41; + "\n"xxx41;;
                    int length = xxx40;intxxx41; conn.getLengthxxx40;xxx41;;
                    frmMain.appendxxx40;"Resp Lengthxxx58; " + length + "\n"xxx41;;                
                    InputStream is = conn.openInputStreamxxx40;xxx41;;
                    int ch;
                    long bytesRead = 0;
                    whilexxx40;xxx40;ch = is.readxxx40;xxx41;xxx41; != -1xxx41; 
                    xxx123;
                        bytesRead++;
                    xxx125;
                    frmMain.appendxxx40;"Read " + bytesRead + " bytes\n"xxx41;;  
                    frmMain.appendxxx40;"Done Reading InputStream\n"xxx41;;
                    is.closexxx40;xxx41;;
                    conn.closexxx40;xxx41;;
                xxx125;
            xxx125;
            catchxxx40;Exception exxx41;
            xxx123;
                frmMain.appendxxx40;"ERRORxxx58; " + e.getMessagexxx40;xxx41; + "\n"xxx41;;
            xxx125;
            frmMain.appendxxx40;"Exit Exec HTTP\n"xxx41;;        
        xxx125;
    xxx125;
xxx125;
__________________
I am a Node of Server
Offline  
Old 03-08-2005, 04:56 PM   #2
greenhut
Thumbs Must Hurt
 
Join Date: Feb 2005
Location: Atlanta, GA
Model: 8300
Carrier: tmo
Posts: 102
Default

Sorry - can't help, but can sympathize. I am having the same problem with my code. Also noticed some Verichat user reporting the same issue...
Offline  
Old 04-03-2007, 04:42 AM   #3
bhushan.balki
New Member
 
Join Date: Mar 2007
Location: Nagpur
Model: 7290
Carrier: airtel
Posts: 1
Default

Hi, Try using IP instead of URL

HttpConnection conn = (HttpConnection) Connector.open("206.268.0.234");
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


ENDOXPERT GASTROENTROLOGY MEMORY BASKET BRAND NEW picture

ENDOXPERT GASTROENTROLOGY MEMORY BASKET BRAND NEW

$118.36



New Siemens 6ES7953-8LL31-0AA0 SIMATIC S7, Micro Memory Card 6ES7 953-8LL31-0AA0 picture

New Siemens 6ES7953-8LL31-0AA0 SIMATIC S7, Micro Memory Card 6ES7 953-8LL31-0AA0

$144.11



Micron MT16VDDT12864AY-40BF2  Crucial Memory Stick Module 1GB - SINGLE picture

Micron MT16VDDT12864AY-40BF2 Crucial Memory Stick Module 1GB - SINGLE

$24.95



2 - RAM DRAM Tray-Container Box For Server PC Memory DIMM Modules - Fits 100 NEW picture

2 - RAM DRAM Tray-Container Box For Server PC Memory DIMM Modules - Fits 100 NEW

$21.90



Okuma E4809-045-091-E OPUS 5000II Board CMOS Memory E4809-045-167-C TCC-A 112-C picture

Okuma E4809-045-091-E OPUS 5000II Board CMOS Memory E4809-045-167-C TCC-A 112-C

$225.00



We R Makers The Cinch Book Binding Machine Round hole V 2 White Aqua 71050-9 picture

We R Makers The Cinch Book Binding Machine Round hole V 2 White Aqua 71050-9

$79.99







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.