Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
01-09-2014, 02:59 AM
|
#1
|
Member
Registered: Dec 2013
Location: Japan
Distribution: Debian...very few times Ubuntu
Posts: 51
Rep:
|
How to send images through a network
Hello everybody. I would appreciate some help on the following.
I have read this tutorial on Network Programming
Beej's Guide to Network Programming
It is quite useful. With this I have been able to send text over a virtual LAN connection and also over a LAN cable from one microcontroller running (a variant of ) uCLinux to a PC running a virtual Debian Linux.
So far so good.
My question is how do I send images, ergo graphic data? Can I use the same technique or have to pack the data in some way?
Is there a resource or book or tutorial which deals with this?
Any help will be greatly appreciated
Thanks
Kansai
|
|
|
01-09-2014, 09:00 PM
|
#2
|
Moderator
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
|
From the point of network sockets it is irrelevant which type of data you send, so you can use the same technique.
|
|
1 members found this post helpful.
|
01-09-2014, 11:41 PM
|
#3
|
Member
Registered: Dec 2013
Location: Japan
Distribution: Debian...very few times Ubuntu
Posts: 51
Original Poster
Rep:
|
Quote:
Originally Posted by TobiSGD
From the point of network sockets it is irrelevant which type of data you send, so you can use the same technique.
|
Thank you very much for your response.
I understand that theoretically what you said is true. However I imagine image data is quite large, so sending it just as I did with text data has a high probability of failing (to send the whole data)
I have heard that perhaps I have to pack the data first.
Any idea of how this can be done?
Thanks!
-----------------------
P.S. So far I have ideas floating in my head, such as sending an image byte by byte... (oh mine!) or cutting it into chunks...
|
|
|
01-09-2014, 11:46 PM
|
#4
|
Moderator
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
|
If you use TCP error checking should be done automatically.
|
|
|
01-09-2014, 11:48 PM
|
#5
|
Moderator
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,306
|
Quote:
Originally Posted by KansaiRobot
Thank you very much for your response.
I understand that theoretically what you said is true. However I imagine image data is quite large, so sending it just as I did with text data has a high probability of failing (to send the whole data)
I have heard that perhaps I have to pack the data first.
Any idea of how this can be done?
Thanks!
-----------------------
P.S. So far I have ideas floating in my head, such as sending an image byte by byte... (oh mine!) or cutting it into chunks...
|
Well, you don't "have" to, but you may want to gzip it (see man gzip)
If your original file was someimage.png, then you might try this...
Code:
gzip someimage.png
Then send the file someimage.png.gz...
Then on the receiving end...
gunzip someimage.png.gz
For multiple files archive them with tar (see man tar).
|
|
|
01-10-2014, 03:09 AM
|
#6
|
Member
Registered: Aug 2010
Location: Netherlands
Distribution: Kubuntu, Debian, Suse, Slackware
Posts: 317
Rep:
|
I think he is more concerned with connection loss. That is why most protocols on top of TCP/IP (like bittorent, rsync) have build-in restart options, so they can continue when a connection got lost.
@kansai if you need that restart/continue functionality, you have to add that yourself. Beej's guide will only give you the basics. Of course you could always take a peek at the way some other software does it. Afterall that's what FOSS is all about :0
Cheers
|
|
|
01-10-2014, 08:36 AM
|
#7
|
Moderator
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
|
Quote:
Originally Posted by astrogeek
Well, you don't "have" to, but you may want to gzip it (see man gzip)
If your original file was someimage.png, then you might try this...
Code:
gzip someimage.png
Then send the file someimage.png.gz...
Then on the receiving end...
gunzip someimage.png.gz
For multiple files archive them with tar (see man tar).
|
Image formats like PNG and JPG are already compressed. Using compression algorithms like gzip on them is likely to make them slightly larger, but in almost any case they will not be smaller afterwards.
|
|
1 members found this post helpful.
|
All times are GMT -5. The time now is 06:44 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|