×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    7

    Unhappy HTTP Connect problem getting photos

    Hi all.

    I developed a app using MIDP exc.. The application is working 110% accept for one problem.. In my app i do a HTTP post to a url to get a picture. Now, this works fine but only on certain phones..I use a nokia 6680 and their is no prob,but when I try my friends new N80 for instance,the other data gets send through but the photo not..This is using gprs,when he uses he's WIFI to connect it works fine! Why is this, can it b my code,the network ,the phone itself or what?? I need to get this resolved asap for this project needs to get finished!

    I have attached part of the html code,please advise me on meaby a stupit mistake or anything...

    HttpConnection c = null;
    HttpConnection htt = null;
    DataInputStream dis = null;
    DataInputStream is = null;
    DataOutputStream os = null;

    try {

    String url1 = "http://XXX.php";

    Form waiting = new Form("Connection");
    waiting.append(new StringItem(null,"Connecting."));
    display.setCurrent(waiting);

    //I only do this get because someone once told me it may help..

    c = (HttpConnection) Connector.open(url1);
    c.setRequestMethod(HttpConnection.GET);
    c.getResponseCode();
    c.close();

    c = (HttpConnection)Connector.open(url1);

    c.setRequestMethod(HttpConnection.POST);

    waiting.delete(0);
    waiting.append("Connecting..");

    c.setRequestProperty("User-Agent",
    "Profile/MIDP-1.0 Confirguration/CLDC-1.0");
    c.setRequestProperty("Accept_Language","en-US");

    c.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

    waiting.delete(0);
    waiting.append("Connecting...");

    os = c.openDataOutputStream();

    String params;
    params = "search=" + searchVar;
    waiting.delete(0);
    waiting.append("Connecting...");

    os.write(params.getBytes());

    waiting.delete(0);
    waiting.append("Connecting.....");

    StringBuffer sb = new StringBuffer();
    int respCode = c.getResponseCode();

    waiting.delete(0);
    waiting.append("Connecting.........");

    if (respCode == c.HTTP_OK) {

    //StringBuffer sb = new StringBuffer();
    //os = c.openOutputStream();
    is = c.openDataInputStream();
    waiting.delete(0);
    waiting.append("Connecting............");


    int chr;
    while ((chr = is.read()) != -1)
    sb.append((char) chr);


    Please,any advise will be greatly appriciated!!!

  2. #2
    Super Contributor
    Join Date
    Dec 2005
    Location
    Europe/Poland/Warsaw
    Posts
    1,697

    Re: HTTP Connect problem getting photos

    hi,

    #1
    are you uploading or downloading that image? (its not clear, sorry),

    #2
    take that sim card from your friend N80 and put it into your 6680, it could be related to data carrier (service provider) settings, for example your friend device could be not configured properly for internet access (lets assume that because you got it working while testing on your 6680 and while your friend used w-lan - that is different data provider then service provider)

    regards,
    Peter

  3. #3
    Super Contributor
    Join Date
    Mar 2006
    Location
    Phoenix, AZ. USA
    Posts
    556

    Re: HTTP Connect problem getting photos

    Alot of devices (or WAP gateways) have limitations on the file size they can fetch or receive, you should, if its bigger than like 20k, break it into smaller chunks, search these forums for "httpconn" and "chunked", and following this procedure may help, on my device (6630), I got it up to approx 175(k) i think, before it began having mem issues
    Jason Glass
    http://IChiBanComputers.Com

Similar Threads

  1. 7610 Http connection problem
    By nicole_yap in forum Mobile Java General
    Replies: 2
    Last Post: 2006-03-23, 07:06
  2. A series 40 connectivity problem : unable to connect using SocketConnection
    By dakots in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2006-03-08, 05:14
  3. HTTP Connection Problem N-Gage QD
    By lmr_mobile in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2006-03-03, 13:38
  4. HTTP Connection problem with real series 40 device
    By pagadi in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2004-06-17, 09:28
  5. J2ME HTTP Post problem
    By gilfr in forum Mobile Java General
    Replies: 2
    Last Post: 2003-06-11, 08:13

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×