A<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2B%2B%2FQt%2FQUdpSocket</id>
		<title>C++/Qt/QUdpSocket - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2B%2B%2FQt%2FQUdpSocket"/>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QUdpSocket&amp;action=history"/>
		<updated>2026-04-18T18:32:35Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QUdpSocket&amp;diff=1228&amp;oldid=prev</id>
		<title> в 14:21, 25 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QUdpSocket&amp;diff=1228&amp;oldid=prev"/>
				<updated>2010-05-25T14:21:06Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 14:21, 25 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QUdpSocket&amp;diff=1229&amp;oldid=prev</id>
		<title>Admin: 1 версия:&amp;#32;Импорт контента...</title>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QUdpSocket&amp;diff=1229&amp;oldid=prev"/>
				<updated>2010-05-25T10:25:13Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия: Импорт контента...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Udp based QUdpSocket==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;  &lt;br /&gt;
Foundations of Qt Development\Chapter14\udpclient\listener.cpp&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2006-2007, Johan Thelin&lt;br /&gt;
 * &lt;br /&gt;
 * All rights reserved.&lt;br /&gt;
 * &lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without modification, &lt;br /&gt;
 * are permitted provided that the following conditions are met:&lt;br /&gt;
 * &lt;br /&gt;
 *     * Redistributions of source code must retain the above copyright notice, &lt;br /&gt;
 *       this list of conditions and the following disclaimer.&lt;br /&gt;
 *     * Redistributions in binary form must reproduce the above copyright notice,  &lt;br /&gt;
 *       this list of conditions and the following disclaimer in the documentation &lt;br /&gt;
 *       and/or other materials provided with the distribution.&lt;br /&gt;
 *     * Neither the name of APress nor the names of its contributors &lt;br /&gt;
 *       may be used to endorse or promote products derived from this software &lt;br /&gt;
 *       without specific prior written permission.&lt;br /&gt;
 * &lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS&lt;br /&gt;
 * &amp;quot;AS IS&amp;quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT&lt;br /&gt;
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR&lt;br /&gt;
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR&lt;br /&gt;
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,&lt;br /&gt;
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR&lt;br /&gt;
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;br /&gt;
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&lt;br /&gt;
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;br /&gt;
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
#include &amp;quot;listener.h&amp;quot;&lt;br /&gt;
#include &amp;lt;QImage&amp;gt;&lt;br /&gt;
#include &amp;lt;QPixmap&amp;gt;&lt;br /&gt;
#include &amp;lt;QUdpSocket&amp;gt;&lt;br /&gt;
#include &amp;lt;QDataStream&amp;gt;&lt;br /&gt;
Listener::Listener( QWidget *parent ) : QLabel( parent )&lt;br /&gt;
{&lt;br /&gt;
  setText( &amp;quot;Waiting for data.&amp;quot; );&lt;br /&gt;
  image = 0;  &lt;br /&gt;
  &lt;br /&gt;
  socket = new QUdpSocket( this );&lt;br /&gt;
  socket-&amp;gt;bind( 9988 );&lt;br /&gt;
  &lt;br /&gt;
  connect( socket, SIGNAL(readyRead()), this, SLOT(dataPending()) );&lt;br /&gt;
}&lt;br /&gt;
void Listener::dataPending()&lt;br /&gt;
{&lt;br /&gt;
  while( socket-&amp;gt;hasPendingDatagrams() )&lt;br /&gt;
  {&lt;br /&gt;
    QByteArray buffer( socket-&amp;gt;pendingDatagramSize(), 0 );&lt;br /&gt;
    socket-&amp;gt;readDatagram( buffer.data(), buffer.size() );&lt;br /&gt;
    &lt;br /&gt;
    QDataStream stream( buffer );&lt;br /&gt;
    stream.setVersion( QDataStream::Qt_4_0 );&lt;br /&gt;
    &lt;br /&gt;
    quint16 width, height, y;&lt;br /&gt;
    stream &amp;gt;&amp;gt; width &amp;gt;&amp;gt; height &amp;gt;&amp;gt; y;&lt;br /&gt;
    &lt;br /&gt;
    if( !image )&lt;br /&gt;
      image = new QImage( width, height, QImage::Format_RGB32 );&lt;br /&gt;
    else if( image-&amp;gt;width() != width || image-&amp;gt;height() != height )&lt;br /&gt;
    {&lt;br /&gt;
      delete image;&lt;br /&gt;
      image = new QImage( width, height, QImage::Format_RGB32 );&lt;br /&gt;
    }&lt;br /&gt;
    for( int x=0; x&amp;lt;width; ++x )&lt;br /&gt;
    {&lt;br /&gt;
      quint8 red, green, blue;&lt;br /&gt;
      stream &amp;gt;&amp;gt; red &amp;gt;&amp;gt; green &amp;gt;&amp;gt; blue;&lt;br /&gt;
      &lt;br /&gt;
      image-&amp;gt;setPixel( x, y, qRgb( red, green, blue ) );&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  setText( &amp;quot;&amp;quot; );&lt;br /&gt;
  setPixmap( QPixmap::fromImage( *image ) );&lt;br /&gt;
  resize( image-&amp;gt;size() );&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Foundations of Qt Development\Chapter14\udpclient\listener.h&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2006-2007, Johan Thelin&lt;br /&gt;
 * &lt;br /&gt;
 * All rights reserved.&lt;br /&gt;
 * &lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without modification, &lt;br /&gt;
 * are permitted provided that the following conditions are met:&lt;br /&gt;
 * &lt;br /&gt;
 *     * Redistributions of source code must retain the above copyright notice, &lt;br /&gt;
 *       this list of conditions and the following disclaimer.&lt;br /&gt;
 *     * Redistributions in binary form must reproduce the above copyright notice,  &lt;br /&gt;
 *       this list of conditions and the following disclaimer in the documentation &lt;br /&gt;
 *       and/or other materials provided with the distribution.&lt;br /&gt;
 *     * Neither the name of APress nor the names of its contributors &lt;br /&gt;
 *       may be used to endorse or promote products derived from this software &lt;br /&gt;
 *       without specific prior written permission.&lt;br /&gt;
 * &lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS&lt;br /&gt;
 * &amp;quot;AS IS&amp;quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT&lt;br /&gt;
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR&lt;br /&gt;
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR&lt;br /&gt;
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,&lt;br /&gt;
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR&lt;br /&gt;
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;br /&gt;
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&lt;br /&gt;
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;br /&gt;
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
#ifndef LISTENER_H&lt;br /&gt;
#define LISTENER_H&lt;br /&gt;
#include &amp;lt;QLabel&amp;gt;&lt;br /&gt;
class QUdpSocket;&lt;br /&gt;
class QImage;&lt;br /&gt;
class Listener : public QLabel&lt;br /&gt;
{&lt;br /&gt;
  Q_OBJECT&lt;br /&gt;
  &lt;br /&gt;
public:&lt;br /&gt;
  Listener( QWidget *parent=0 );&lt;br /&gt;
  &lt;br /&gt;
private slots:&lt;br /&gt;
  void dataPending();&lt;br /&gt;
  &lt;br /&gt;
private:&lt;br /&gt;
  QUdpSocket *socket;&lt;br /&gt;
  QImage *image;&lt;br /&gt;
};&lt;br /&gt;
#endif // LISTENER_H&lt;br /&gt;
&lt;br /&gt;
Foundations of Qt Development\Chapter14\udpclient\main.cpp&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2006-2007, Johan Thelin&lt;br /&gt;
 * &lt;br /&gt;
 * All rights reserved.&lt;br /&gt;
 * &lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without modification, &lt;br /&gt;
 * are permitted provided that the following conditions are met:&lt;br /&gt;
 * &lt;br /&gt;
 *     * Redistributions of source code must retain the above copyright notice, &lt;br /&gt;
 *       this list of conditions and the following disclaimer.&lt;br /&gt;
 *     * Redistributions in binary form must reproduce the above copyright notice,  &lt;br /&gt;
 *       this list of conditions and the following disclaimer in the documentation &lt;br /&gt;
 *       and/or other materials provided with the distribution.&lt;br /&gt;
 *     * Neither the name of APress nor the names of its contributors &lt;br /&gt;
 *       may be used to endorse or promote products derived from this software &lt;br /&gt;
 *       without specific prior written permission.&lt;br /&gt;
 * &lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS&lt;br /&gt;
 * &amp;quot;AS IS&amp;quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT&lt;br /&gt;
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR&lt;br /&gt;
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR&lt;br /&gt;
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,&lt;br /&gt;
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR&lt;br /&gt;
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;br /&gt;
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&lt;br /&gt;
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;br /&gt;
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
#include &amp;lt;QApplication&amp;gt;&lt;br /&gt;
#include &amp;quot;listener.h&amp;quot;&lt;br /&gt;
int main( int argc, char **argv )&lt;br /&gt;
{&lt;br /&gt;
  QApplication app( argc, argv );&lt;br /&gt;
  &lt;br /&gt;
  Listener listener;&lt;br /&gt;
  listener.show();&lt;br /&gt;
  &lt;br /&gt;
  return app.exec();&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Udp server==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
Foundations of Qt Development\Chapter14\udpserver\main.cpp&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2006-2007, Johan Thelin&lt;br /&gt;
 * &lt;br /&gt;
 * All rights reserved.&lt;br /&gt;
 * &lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without modification, &lt;br /&gt;
 * are permitted provided that the following conditions are met:&lt;br /&gt;
 * &lt;br /&gt;
 *     * Redistributions of source code must retain the above copyright notice, &lt;br /&gt;
 *       this list of conditions and the following disclaimer.&lt;br /&gt;
 *     * Redistributions in binary form must reproduce the above copyright notice,  &lt;br /&gt;
 *       this list of conditions and the following disclaimer in the documentation &lt;br /&gt;
 *       and/or other materials provided with the distribution.&lt;br /&gt;
 *     * Neither the name of APress nor the names of its contributors &lt;br /&gt;
 *       may be used to endorse or promote products derived from this software &lt;br /&gt;
 *       without specific prior written permission.&lt;br /&gt;
 * &lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS&lt;br /&gt;
 * &amp;quot;AS IS&amp;quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT&lt;br /&gt;
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR&lt;br /&gt;
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR&lt;br /&gt;
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,&lt;br /&gt;
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR&lt;br /&gt;
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;br /&gt;
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&lt;br /&gt;
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;br /&gt;
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
#include &amp;lt;QApplication&amp;gt;&lt;br /&gt;
#include &amp;lt;QMessageBox&amp;gt;&lt;br /&gt;
#include &amp;quot;sender.h&amp;quot;&lt;br /&gt;
int main( int argc, char **argv )&lt;br /&gt;
{&lt;br /&gt;
  QApplication app( argc, argv );&lt;br /&gt;
  &lt;br /&gt;
  Sender sender;&lt;br /&gt;
  QMessageBox::information( 0, &amp;quot;Info&amp;quot;, &amp;quot;Broadcasting image&amp;quot; );&lt;br /&gt;
    &lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Foundations of Qt Development\Chapter14\udpserver\sender.cpp&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2006-2007, Johan Thelin&lt;br /&gt;
 * &lt;br /&gt;
 * All rights reserved.&lt;br /&gt;
 * &lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without modification, &lt;br /&gt;
 * are permitted provided that the following conditions are met:&lt;br /&gt;
 * &lt;br /&gt;
 *     * Redistributions of source code must retain the above copyright notice, &lt;br /&gt;
 *       this list of conditions and the following disclaimer.&lt;br /&gt;
 *     * Redistributions in binary form must reproduce the above copyright notice,  &lt;br /&gt;
 *       this list of conditions and the following disclaimer in the documentation &lt;br /&gt;
 *       and/or other materials provided with the distribution.&lt;br /&gt;
 *     * Neither the name of APress nor the names of its contributors &lt;br /&gt;
 *       may be used to endorse or promote products derived from this software &lt;br /&gt;
 *       without specific prior written permission.&lt;br /&gt;
 * &lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS&lt;br /&gt;
 * &amp;quot;AS IS&amp;quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT&lt;br /&gt;
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR&lt;br /&gt;
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR&lt;br /&gt;
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,&lt;br /&gt;
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR&lt;br /&gt;
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;br /&gt;
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&lt;br /&gt;
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;br /&gt;
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
#include &amp;quot;sender.h&amp;quot;&lt;br /&gt;
#include &amp;lt;QImage&amp;gt;&lt;br /&gt;
#include &amp;lt;QUdpSocket&amp;gt;&lt;br /&gt;
#include &amp;lt;QTimer&amp;gt;&lt;br /&gt;
#include &amp;lt;QByteArray&amp;gt;&lt;br /&gt;
#include &amp;lt;QDataStream&amp;gt;&lt;br /&gt;
Sender::Sender()&lt;br /&gt;
{&lt;br /&gt;
  socket = new QUdpSocket( this );&lt;br /&gt;
  &lt;br /&gt;
  image = new QImage( &amp;quot;test.png&amp;quot; );&lt;br /&gt;
  if( image-&amp;gt;isNull() )&lt;br /&gt;
    qFatal( &amp;quot;Failed to open test.png&amp;quot; );&lt;br /&gt;
  QTimer *timer = new QTimer( this );&lt;br /&gt;
  timer-&amp;gt;setInterval( 250 );&lt;br /&gt;
  timer-&amp;gt;start();&lt;br /&gt;
  &lt;br /&gt;
  connect( timer, SIGNAL(timeout()), this, SLOT(broadcastLine()) );&lt;br /&gt;
}&lt;br /&gt;
void Sender::broadcastLine()&lt;br /&gt;
{&lt;br /&gt;
  QByteArray buffer( 6+3*image-&amp;gt;width(), 0 );&lt;br /&gt;
  QDataStream stream( &amp;amp;buffer, QIODevice::WriteOnly );&lt;br /&gt;
  stream.setVersion( QDataStream::Qt_4_0 );&lt;br /&gt;
  &lt;br /&gt;
  stream &amp;lt;&amp;lt; (quint16)image-&amp;gt;width() &amp;lt;&amp;lt; (quint16)image-&amp;gt;height();&lt;br /&gt;
  &lt;br /&gt;
  quint16 y = qrand() % image-&amp;gt;height();&lt;br /&gt;
  &lt;br /&gt;
  stream &amp;lt;&amp;lt; y;&lt;br /&gt;
  &lt;br /&gt;
  for( int x=0; x&amp;lt;image-&amp;gt;width(); ++x )&lt;br /&gt;
  {&lt;br /&gt;
    QRgb rgb = image-&amp;gt;pixel( x, y );&lt;br /&gt;
    &lt;br /&gt;
    stream &amp;lt;&amp;lt; (quint8)qRed( rgb ) &amp;lt;&amp;lt; (quint8)qGreen( rgb ) &amp;lt;&amp;lt; (quint8)qBlue( rgb );&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  socket-&amp;gt;writeDatagram( buffer, QHostAddress::Broadcast, 9988 );&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Foundations of Qt Development\Chapter14\udpserver\sender.h&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2006-2007, Johan Thelin&lt;br /&gt;
 * &lt;br /&gt;
 * All rights reserved.&lt;br /&gt;
 * &lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without modification, &lt;br /&gt;
 * are permitted provided that the following conditions are met:&lt;br /&gt;
 * &lt;br /&gt;
 *     * Redistributions of source code must retain the above copyright notice, &lt;br /&gt;
 *       this list of conditions and the following disclaimer.&lt;br /&gt;
 *     * Redistributions in binary form must reproduce the above copyright notice,  &lt;br /&gt;
 *       this list of conditions and the following disclaimer in the documentation &lt;br /&gt;
 *       and/or other materials provided with the distribution.&lt;br /&gt;
 *     * Neither the name of APress nor the names of its contributors &lt;br /&gt;
 *       may be used to endorse or promote products derived from this software &lt;br /&gt;
 *       without specific prior written permission.&lt;br /&gt;
 * &lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS&lt;br /&gt;
 * &amp;quot;AS IS&amp;quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT&lt;br /&gt;
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR&lt;br /&gt;
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR&lt;br /&gt;
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,&lt;br /&gt;
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR&lt;br /&gt;
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;br /&gt;
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&lt;br /&gt;
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;br /&gt;
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
#ifndef SENDER_H&lt;br /&gt;
#define SENDER_H&lt;br /&gt;
#include &amp;lt;QObject&amp;gt;&lt;br /&gt;
class QUdpSocket;&lt;br /&gt;
class QImage;&lt;br /&gt;
class Sender : public QObject&lt;br /&gt;
{&lt;br /&gt;
  Q_OBJECT&lt;br /&gt;
public:&lt;br /&gt;
  Sender();&lt;br /&gt;
  &lt;br /&gt;
private slots:&lt;br /&gt;
  void broadcastLine();&lt;br /&gt;
  &lt;br /&gt;
private:&lt;br /&gt;
  QUdpSocket *socket;&lt;br /&gt;
  QImage *image;&lt;br /&gt;
};&lt;br /&gt;
#endif // SENDER_H&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>