LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-09-2014, 02:59 AM   #1
KansaiRobot
Member
 
Registered: Dec 2013
Location: Japan
Distribution: Debian...very few times Ubuntu
Posts: 51

Rep: Reputation: 0
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
 
Old 01-09-2014, 09:00 PM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
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.
Old 01-09-2014, 11:41 PM   #3
KansaiRobot
Member
 
Registered: Dec 2013
Location: Japan
Distribution: Debian...very few times Ubuntu
Posts: 51

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by TobiSGD View Post
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...
 
Old 01-09-2014, 11:46 PM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
If you use TCP error checking should be done automatically.
 
Old 01-09-2014, 11:48 PM   #5
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,306
Blog Entries: 24

Rep: Reputation: 4259Reputation: 4259Reputation: 4259Reputation: 4259Reputation: 4259Reputation: 4259Reputation: 4259Reputation: 4259Reputation: 4259Reputation: 4259Reputation: 4259
Quote:
Originally Posted by KansaiRobot View Post
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).
 
Old 01-10-2014, 03:09 AM   #6
gdejonge
Member
 
Registered: Aug 2010
Location: Netherlands
Distribution: Kubuntu, Debian, Suse, Slackware
Posts: 317

Rep: Reputation: 73
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
 
Old 01-10-2014, 08:36 AM   #7
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by astrogeek View Post
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.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Not seeing images outside of my local network?!?! Heinz09 Linux - Security 5 05-05-2009 04:43 PM
Playing DVD ISO Images Across a Network Woodsman Slackware 9 09-02-2008 01:44 PM
Postfix : mail cannot send to send outside ( can send/receive locally) bobbinsupport Linux - Networking 3 12-15-2007 11:40 PM
send mail with inline images along with html in perl tanveer Linux - General 2 12-14-2007 06:23 AM
Send images to many users munna_dude Linux - Networking 1 06-14-2007 04:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration