• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Sending text+ pics

 
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello poeple,
I need some advice. I want to send small articles with pics to a mobile phone. I don't want to send the text with a link to the pic, coz with the latency of wireless networks, it takes really a long to connect and fetch the image.. I am thinking of sending text and at the end a picture, no mime no encoding, after the image tag or whatever delimitor, the rest of the bytes will all be for the image.. I am thinking of making an image out of all the articles images, and easilly cut them at the client side since they all have the same width/hieght ??
Will this work out? any ideas? Is there a way around? force the web server to keep the connection?
Any help will be appreciated.
Thanks a lot.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does your client device even have a display API that allows for a message containing mixed text and image data? Are you writing code for both the client and the server?
Bill
 
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Tonny Tssagovic:
Hello poeple,
Will this work out? any ideas? Is there a way around? force the web server to keep the connection?
Any help will be appreciated.
Thanks a lot.


HTTP 1.1 has keep-alive connection, but it is still a *stateless* protocal. So you can't do this.
I have done wireless deivce programming way back in year 200-2001; and they didn't have any persitance mechanism back then as far as I can remember. Things must have changed rapudly since then...What sort of image format you'd be using for your mobile devices?
- Manish
 
Tonny Tssagovic
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for ur replies guys!
I use PNG format supported by J2me clients. and yes I am also making the client's code, and will make a custom Canvas that can show both text and image.. Any thoughts?
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Seems to me you have two decisions to make:
1. How to tell when the text info stops and the image info starts.
2. How to transmit the image info.
For 1 - you could use a marker string like multipart mail does or you could start your text with a character count.
For 2 - the big question is binary versus encoded binary - if your server side is sending a character stream, which involves character translation with a writer, you will have to encode the image - base64 is the most efficient. If your server side is sending a byte stream you should be able to send the binary image directly.
Bill
 
Tonny Tssagovic
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply William
Well, I am probably going to send binary data, since I don't want to have a base 64 decoder at the client side... But are there any problems with sending international text (like the scandinavian �� and so on) in a binary stream? How about the HTTP protocol content type, I have it set to an image now since I am sending only an image, and I have another set to text to send only text.. now I want to have both, no probs with that?? for the delimiter I will just use the something like IMAGE tag or so, since my text is not going to contain such a tag.. and when I reach it I would not care about tags any longer since I would know that according to my protocol, the rest of the stream is a single Image..
Any hel�p will be appreciated.
PS: Others are very welcome to come with IDEAs..
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want the international character capability I think you are going to be creating a character stream with a writer - that means you are going to need to send the image in characters which means encoding. A base64 decoder can be really compact, especially in your case where you completely control both sides and can eliminate special cases.
If you are writing the entire client you can use any HTTP content type you like - it does not affect transmission, only clients like a browser. You might even use a custom header to give the length of the text block.
Bill
 
Tonny Tssagovic
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks again William
Well so if I have internatinal text, I must use a charecter stream ?? there is no way around ? Coz it seems to me, 64 encoding will slow my app down and increase its already big size.. Maybe downloading the text /the images one at once will be better..
Any ideas???
Any input is very much appreciated.
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm no expert on the handling of international character sets in typical phones, so I'll pass on that - maybe the J2ME forum can help you there.
Base64 takes 4 bytes to encode 3, so it is not a big deal. Decoding is likely to be fast compared to phone transmission speed or to the time for a second request/response cycle.
Bill
reply
    Bookmark Topic Watch Topic
  • New Topic