Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

client/server app under development

 
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

I've been working on a client/server application that includes chat and whiteboard features. In terms of how the client app communicates with the server app, my initial thought was to just go with xml, until I reached a snag. Everything about chat and almost everything that is accomplished on the whiteboard can be expressed in terms of text or character data; which what makes xml a good candidate for moving the data back and forth from client to server. However, there's one part of the whiteboard feature that can't be converted to just text. The whiteboard has an ImageTool. With it you can select an image (gif,jpg) from your harddrive and load it into the whiteboard. An image is binary data and simply cannot be put into an xml file for transport. At least, that's my understanding. Am I wrong about this?

So, this poses the questions: "How do other similar applications like MSN Messenger move images around? If they're not using xml as there medium, what are they using? Just plain sockets without any structured medium like xml?"

Please advise,

Alan
 
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
Encode binary data such as images as base64 text strings when you have to transport by XML. There will be some overhead in characters and processing of course. See the apache commons codec toolkit for encoding and decoding classes.

Bill
 
Rancher
Posts: 4686
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bill's answer is a good, general solution.

But you might want to consider your problem space a bit more carefully. In a whiteboard application, the trivial approach would be to just capture the whole graphic space, run it through PNG or JPEG to compress it, and send it as Bill suggested.

But in nearly all whiteboard uses, the bit map is fairly inefficient and tends to have fixed scale. If your users are using displays with varying capabilities, say a 21" LCD, a projector and a iPhone, you might be better off recording the vector strokes and wrapping them in the XML. Something like
[CODE]
<stroke> <start-x>1203</start-x><start-y>2301</start-y>
<end-x>1602</end-X>
<end-y>4300</end-y>
</stroke>
/CODE]
[ November 08, 2007: Message edited by: Pat Farrell ]
 
Alan Shiers
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

But you might want to consider your problem space a bit more carefully. In a whiteboard application, the trivial approach would be to just capture the whole graphic space, run it through PNG or JPEG to compress it, and send it as Bill suggested.

But in nearly all whiteboard uses, the bit map is fairly inefficient and tends to have fixed scale. If your users are using displays with varying capabilities, say a 21" LCD, a projector and a iPhone, you might be better off recording the vector strokes and wrapping them in the XML. Something like



As far as detailing the different shapes in xml, it was my initial intention to break them down as you say. What is a shape after all...just a bunch of Points on the whiteboard with lines drawn between them. Connect the dots.
So, indeed, my xml markup would be similar to your example. My only concern was moving binary image data due to the ImageTool. I didn't know if that was possible with xml. So, as suggested, I'll try this Base64 encoding process and see how that works. If I have problems with it, I'll let you know.

Thanks guys,

Alan
 
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
For compact description of images generated by "stroke" style operations, there are several possibilities. See this Wikipedia summary for examples.

Bill
 
I didn't like the taste of tongue and it didn't like the taste of me. I will now try this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic