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



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


Windsor Commodore Duo 20

Windsor Commodore Duo 20" Carpet extractor w/Lester Charger 25900/Battery/99hour

$2911.95



Vintage Printer Switch box Commodore 64/Sanyo Mountable Computer PC picture

Vintage Printer Switch box Commodore 64/Sanyo Mountable Computer PC

$49.00



Jelenko Commodore LS VPF with Pump  picture

Jelenko Commodore LS VPF with Pump

$875.00



POLAR PLASTICS C64 Construction Film,6x100,4Mil,Clear PK 4 picture

POLAR PLASTICS C64 Construction Film,6x100,4Mil,Clear PK 4

$178.04



Mahlo K 1313 /w Base Terminal 2263036 SKBI 64/C64 Gepruft PLC K1313 Dual P/I picture

Mahlo K 1313 /w Base Terminal 2263036 SKBI 64/C64 Gepruft PLC K1313 Dual P/I

$650.00



Vintage Holt Commodore Commercial Floor Scrubber Polisher Buffer Burnisher 20

Vintage Holt Commodore Commercial Floor Scrubber Polisher Buffer Burnisher 20"

$599.99







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