<br><div class="gmail_quote">On Wed, Apr 6, 2011 at 4:17 PM, Littlefield, Tyler <span dir="ltr"><<a href="mailto:tyler@tysdomain.com">tyler@tysdomain.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On 4/6/2011 4:58 PM, craf wrote:<br>
</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">
>Hello.<br>
><br>
>I'm testing the sockets in Python and I've seen the way in which<br>
>works to send string. My question is if anyone knows where<br>
>can find some information on how to send pictures through<br>
>Sockets. I use Python 2.7 and have read the information regarding<br>
>Sockets of the Python website, but I can not begin.<br></div>
Pictures are just like strings; grab it, send it in binary and you are set.</blockquote></blockquote><div><br>But you might want to frame your data somehow - say, but sending a length of the picture before sending the picture itself, or wrapping it up in a tar archive or something.  Sending a number indicating the number of pictures can be helpful too.<br>
<br>BTW, sockets are allowed to fragment what you send, so if you send an entire picture in a single write, it could show up as 1, 2, or 3 (or whatever) recv's on the other end.  And if you send 3 pictures, it could arrive in 1 big recv, or 10, or whatever.  So framing your data can be very important with sockets.<br>
<br>I tend to use my (OK, UCI's, but I wrote it) bufsock module to facilitate framing, but I'm sure there are other ways.  It's described here: <a href="http://stromberg.dnsalias.org/~strombrg/bufsock.html">http://stromberg.dnsalias.org/~strombrg/bufsock.html</a><br>
And there's a newer version at <a href="http://stromberg.dnsalias.org/svn/bufsock/trunk/">http://stromberg.dnsalias.org/svn/bufsock/trunk/</a><br><br></div></div><br>