473,769 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Advice on sending images to clients over network

Hi all

This is not strictly a Python question, but as the system to which
relates is written in Python, hopefully it is not too off-topic.

I have an accounting/business application, written in client/server
mode. The server makes a connection to a database, and then runs a
continuous loop waiting for client connections, establishes a session
with the client, and responds to messages received from the client
until the client closes the connection. The client uses wxPython as
the gui. All the business logic is on the server - there is none at
all on the client side. It seems to be working quite well.

I now want to add the capability of displaying images on the client.
For example, if the application deals with properties, I want to
display various photographs of the property on the client. wxPython is
perfectly capable of displaying the image. My question is, what is the
best way to get the image to the client?

Assume that the images are stored in a directory on the server, or at
least accessible from the server, and that the database has a table
which stores the full path to each image, with the property id as a
reference.

My first thought was that the server would simply retrieve the path,
read the image, and send it to the client over the network, along with
all the other information. The problem with this is performance - I
may set up a page with 20 images to be displayed on the client, which
may take some time. I need the server to respond to client messages as
quickly as possible, so that it is ready to handle the next request.
The server is multi-threaded, so it will not block other threads, but
it may still result in sluggish performance.

My second thought was to send the path to the image down to the
client, and get the client to read the image directly. The problem
with this is that each client needs to be able to resolve the path to
the image directory. At present, all that the client requires is a
pointer to the client program directory, and a parameter giving it the
ip address and port number required to make a connection to the
server. It seems an extra administrative burden to ensure that each
client can access the image directory, especially if at a later date
it is decided to move the directory.

My third thought was to set up a separate 'image server'. It would be
another server program written in Python, listening on its own port
number, waiting for a client request for a particular image. It would
know where to find it, read it in, and send it to the client. Then all
the client needs to know is the ip address and port number.

It seems likely that a typical setup would start by storing the images
on the same machine as the database and the server program. If so,
there would be little difference between any of the above, as no
matter with method is used, the same machine ultimately has to read
the record from its own hard drive and send it down the network over
its own nic.

If at a later date it was decided that the volume of image handling
was slowing down the server process, one might well decide to move the
images to a separate server. In this case, I think that my third
option would make it easiest to facilitate this. You would have to
change all the client parameters to connect to a different server. Or
maybe not - thinking aloud, I could pass the 'image server connection
parameters' to the client from the main server once a connection has
been established. A second implication is that you would have to
change all the paths in the database table. Again, maybe not - just
store the file names in the table, and the path to the directory as a
separate parameter. Then you only have to change the parameter.

I guess the point of all this rambling is that my thought process is
leading me towards my third option, but this would be a bit of work to
set up, so I would appreciate any comments from anyone who has been
down this road before - do I make sense, or are there better ways to
handle this?

Any suggestions will be much appreciated.

Thanks

Frank Millman

Jul 22 '07 #1
8 1990
Frank Millman wrote:
My question is, what is the best way to get the image to the
client?
IMHO, HTTP would be most painless. Either incorporate a little HTTP
server into your server application, or use a seperate daemon and
let the server only output HTTP links.
My third thought was to set up a separate 'image server'. It would
be another server program written in Python, listening on its own
port number, waiting for a client request for a particular image.
It would know where to find it, read it in, and send it to the
client. Then all the client needs to know is the ip address and
port number.
See above -- you could also write your own HTTP server. Best using
Twisted or something of similar high level. Why make yourself work
developing such a system when somebody already did it for you?
I guess the point of all this rambling is that my thought process
is leading me towards my third option, but this would be a bit of
work to set up, so I would appreciate any comments from anyone who
has been down this road before - do I make sense, or are there
better ways to handle this?
For minimum additional work, I'd use some lightweight http daemon,
like lighttpd ot thttpd. Then your server can pass links like
<http://yourserver.exam ple.com/images/thingy1.jpegand the clients
can use well-tested standard library routines to retrieve the
image.

Regards,
Björn

--
BOFH excuse #174:

Backbone adjustment

Jul 22 '07 #2
Frank Millman <fr***@chagford .comwrites:
Any suggestions will be much appreciated.
Why on earth don't you write the whole thing as a web app instead of
a special protocol? Then just use normal html tags to put images
into the relevant pages.
Jul 22 '07 #3
Frank Millman wrote:
I guess the point of all this rambling is that my thought process is
leading me towards my third option, but this would be a bit of work to
set up, so I would appreciate any comments from anyone who has been
down this road before - do I make sense, or are there better ways to
handle this?

Any suggestions will be much appreciated.
I would put the images into a static web directory, either on the same
or different server. Then your main server just sends the url (or
relevant portion of the url, or list of all urls to download), and then
the client grabs the images from your image server using urllib.

Let Apache do what it's good at, instead of reinventing that particular
wheel.

--
pkm ~ http://paulmcnett.com
Jul 22 '07 #4
Paul Rubin wrote:
Frank Millman <fr***@chagford .comwrites:
>Any suggestions will be much appreciated.

Why on earth don't you write the whole thing as a web app instead of
a special protocol? Then just use normal html tags to put images
into the relevant pages.
I believe he has a full desktop client app, not a web app. Believe it or
not, there's still a solid place for desktop applications even in this
ever-increasing webified world.

Use the right tool for the job...
--
pkm ~ http://paulmcnett.com
Jul 22 '07 #5
Paul McNett wrote:
Paul Rubin wrote:
>Frank Millman <fr***@chagford .comwrites:
>>Any suggestions will be much appreciated.

Why on earth don't you write the whole thing as a web app instead of
a special protocol? Then just use normal html tags to put images
into the relevant pages.

I believe he has a full desktop client app, not a web app. Believe it or
not, there's still a solid place for desktop applications even in this
ever-increasing webified world.
He's using wxPython and already has network connectivity to access the
database server.
Use the right tool for the job...
Yep... I also believe that a HTTP server is the right tool. :-)
Jul 22 '07 #6
On 7/22/07, Paul McNett <p@ulmcnett.com wrote:
Paul Rubin wrote:
Frank Millman <fr***@chagford .comwrites:
Any suggestions will be much appreciated.
Why on earth don't you write the whole thing as a web app instead of
a special protocol? Then just use normal html tags to put images
into the relevant pages.

I believe he has a full desktop client app, not a web app. Believe it or
not, there's still a solid place for desktop applications even in this
ever-increasing webified world.

Use the right tool for the job...
There is no reason that something being a "desktop app" means they
can't use HTTP instead of reinventing the protocol wheel all over
again.
--
pkm ~ http://paulmcnett.com
--
http://mail.python.org/mailman/listinfo/python-list

--
Read my blog! I depend on your acceptance of my opinion! I am interesting!
http://ironfroggy-code.blogspot.com/
Jul 22 '07 #7
Calvin Spealman wrote:
On 7/22/07, Paul McNett <p@ulmcnett.com wrote:
>Paul Rubin wrote:
Frank Millman <fr***@chagford .comwrites:
Any suggestions will be much appreciated.

Why on earth don't you write the whole thing as a web app instead of
a special protocol? Then just use normal html tags to put images
into the relevant pages.

I believe he has a full desktop client app, not a web app. Believe it or
not, there's still a solid place for desktop applications even in this
ever-increasing webified world.

Use the right tool for the job...

There is no reason that something being a "desktop app" means they
can't use HTTP instead of reinventing the protocol wheel all over
again.
Absolutely! Which is why I recommended setting up an httpd to serve the
images...

I interpreted Paul Rubin's response to say "rewrite the whole thing
(client, server, everything) as a web app".

Cheers!
--
pkm ~ http://paulmcnett.com
Jul 22 '07 #8

Frank Millman wrote:
Hi all

This is not strictly a Python question, but as the system to which
relates is written in Python, hopefully it is not too off-topic.
[...]
I now want to add the capability of displaying images on the client.
For example, if the application deals with properties, I want to
display various photographs of the property on the client. wxPython is
perfectly capable of displaying the image. My question is, what is the
best way to get the image to the client?
Thanks for all the responses.

The verdict seems unanimous - use http.

Thanks for pointing me in the right direction.

Frank

Jul 23 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2973
by: Francois Keyeux | last post by:
hello everyone: i have a web site built using vbasic active server scripting running on iis (it works on either iis 50 and 60, but is designed for iis 50) i know how to create a plain text email by creating a text file, with content following certain format, and saving that file into the correct '..\mailroot\pickup' folder, and it is working fine
61
4754
by: phil-news-nospam | last post by:
Why does SVG need a different tag than other images? IMHO, SVG should be implemented as an image type just like any other image type, allowing it to work with <img> tags, and ... here is the important part ... also work with backgrounds in other tags. I fail to see any wisdom in making SVG different than say PNG (of course the implementation of the rendering code would obvious be different). --
4
12090
by: david | last post by:
hello, I have a client/server application. the server capture picture from webcam and send it to every client connected to it.the network part works good and the capture from webcam too. I associate an event when a capture is done, then every frame of the webcam should be sent to the client. but I cannot find a way to send bitmap throught network, of course I found many method from internet, some doen't work, some work but it's never...
7
9835
by: undbund | last post by:
Hi I am creating a newsletter system. The software should run from desktop computer (localhost) but be able to send email to anyone on the internet. Can you guys give me some ideas on how to achieve this. Thanks
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10212
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10047
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9995
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7410
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5304
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3962
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3563
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.