~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/qudpsocket.html

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-11-02 18:30:08 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (15.2.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 88.
  • Revision ID: james.westby@ubuntu.com-20091102183008-b6a4gcs128mvfb3m
Tags: upstream-4.6.0~beta1
ImportĀ upstreamĀ versionĀ 4.6.0~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
<!DOCTYPE html
3
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
4
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
 
<!-- /fasttmp/mkdist-qt-4.5.2-1245473805/qt-x11-opensource-src-4.5.2/src/network/socket/qudpsocket.cpp -->
 
5
<!-- qudpsocket.cpp -->
6
6
<head>
7
 
  <title>Qt 4.5: QUdpSocket Class Reference</title>
 
7
  <title>Qt 4.6: QUdpSocket Class Reference</title>
8
8
  <link href="classic.css" rel="stylesheet" type="text/css" />
9
9
</head>
10
10
<body>
 
11
<a name="//apple_ref/cpp/cl//QUdpSocket" />
11
12
<table border="0" cellpadding="0" cellspacing="0" width="100%">
12
13
<tr>
13
 
<td align="left" valign="top" width="32"><a href="http://qtsoftware.com/products/qt"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
14
 
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="namespaces.html"><font color="#004faf">All&nbsp;Namespaces</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
15
 
<td align="right" valign="top" width="230"></td></tr></table><h1 class="title">QUdpSocket Class Reference<br /><span class="small-subtitle">[<a href="qtnetwork.html">QtNetwork</a> module]</span>
 
14
<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
 
15
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">All&nbsp;Functions</font></a>&nbsp;&middot; <a href="overviews.html"><font color="#004faf">Overviews</font></a></td><td class="searchBar" align="right" valign="center"><form action="http://www.google.com/cse" id="cse-search-box"><div><input type="hidden" name="cx" value="000136343326384750312:dhbxnqlakyu" /><input type="hidden" name="ie" value="UTF-8" /><input type="text" name="q" size="31" /><input type="submit" name="sa" value="Search" /></div></form></td>
 
16
</tr></table><h1 class="title">QUdpSocket Class Reference<br /><span class="small-subtitle">[<a href="qtnetwork.html">QtNetwork</a> module]</span>
16
17
</h1>
17
18
<p>The QUdpSocket class provides a UDP socket. <a href="#details">More...</a></p>
18
 
<pre> #include &lt;QUdpSocket&gt;</pre><p>Inherits <a href="qabstractsocket.html">QAbstractSocket</a>.</p>
19
 
<p><b>Note:</b> All the functions in this class are <a href="threads.html#reentrant">reentrant</a>.</p>
 
19
<pre> #include &lt;QUdpSocket&gt;</pre><p><b>This class is not part of the Qt GUI Framework Edition.</b></p>
 
20
<p>Inherits <a href="qabstractsocket.html">QAbstractSocket</a>.</p>
 
21
<p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#reentrant">reentrant</a>.</p>
20
22
<ul>
21
23
<li><a href="qudpsocket-members.html">List of all members, including inherited members</a></li>
22
24
</ul>
 
25
<hr />
23
26
<a name="public-types"></a>
24
 
<h3>Public Types</h3>
25
 
<ul>
26
 
<li><div class="fn"></div>enum <b><a href="qudpsocket.html#BindFlag-enum">BindFlag</a></b> { ShareAddress, DontShareAddress, ReuseAddressHint, DefaultForPlatform }</li>
27
 
<li><div class="fn"></div>flags <b><a href="qudpsocket.html#BindFlag-enum">BindMode</a></b></li>
28
 
</ul>
 
27
<h2>Public Types</h2>
 
28
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
 
29
<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qudpsocket.html#BindFlag-enum">BindFlag</a></b> { ShareAddress, DontShareAddress, ReuseAddressHint, DefaultForPlatform }</td></tr>
 
30
<tr><td class="memItemLeft" align="right" valign="top">flags </td><td class="memItemRight" valign="bottom"><b><a href="qudpsocket.html#BindFlag-enum">BindMode</a></b></td></tr>
 
31
</table>
 
32
<hr />
29
33
<a name="public-functions"></a>
30
 
<h3>Public Functions</h3>
31
 
<ul>
32
 
<li><div class="fn"></div><b><a href="qudpsocket.html#QUdpSocket">QUdpSocket</a></b> ( QObject * <i>parent</i> = 0 )</li>
33
 
<li><div class="fn"></div>virtual <b><a href="qudpsocket.html#dtor.QUdpSocket">~QUdpSocket</a></b> ()</li>
34
 
<li><div class="fn"></div>bool <b><a href="qudpsocket.html#bind">bind</a></b> ( const QHostAddress &amp; <i>address</i>, quint16 <i>port</i> )</li>
35
 
<li><div class="fn"></div>bool <b><a href="qudpsocket.html#bind-2">bind</a></b> ( const QHostAddress &amp; <i>address</i>, quint16 <i>port</i>, BindMode <i>mode</i> )</li>
36
 
<li><div class="fn"></div>bool <b><a href="qudpsocket.html#bind-3">bind</a></b> ( quint16 <i>port</i> = 0 )</li>
37
 
<li><div class="fn"></div>bool <b><a href="qudpsocket.html#bind-4">bind</a></b> ( quint16 <i>port</i>, BindMode <i>mode</i> )</li>
38
 
<li><div class="fn"></div>bool <b><a href="qudpsocket.html#hasPendingDatagrams">hasPendingDatagrams</a></b> () const</li>
39
 
<li><div class="fn"></div>qint64 <b><a href="qudpsocket.html#pendingDatagramSize">pendingDatagramSize</a></b> () const</li>
40
 
<li><div class="fn"></div>qint64 <b><a href="qudpsocket.html#readDatagram">readDatagram</a></b> ( char * <i>data</i>, qint64 <i>maxSize</i>, QHostAddress * <i>address</i> = 0, quint16 * <i>port</i> = 0 )</li>
41
 
<li><div class="fn"></div>qint64 <b><a href="qudpsocket.html#writeDatagram">writeDatagram</a></b> ( const char * <i>data</i>, qint64 <i>size</i>, const QHostAddress &amp; <i>address</i>, quint16 <i>port</i> )</li>
42
 
<li><div class="fn"></div>qint64 <b><a href="qudpsocket.html#writeDatagram-2">writeDatagram</a></b> ( const QByteArray &amp; <i>datagram</i>, const QHostAddress &amp; <i>host</i>, quint16 <i>port</i> )</li>
43
 
</ul>
44
 
<ul>
45
 
<li><div class="fn"></div>27 public functions inherited from <a href="qabstractsocket.html#public-functions">QAbstractSocket</a></li>
46
 
<li><div class="fn"></div>33 public functions inherited from <a href="qiodevice.html#public-functions">QIODevice</a></li>
47
 
<li><div class="fn"></div>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
 
34
<h2>Public Functions</h2>
 
35
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
 
36
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qudpsocket.html#QUdpSocket">QUdpSocket</a></b> ( QObject * <i>parent</i> = 0 )</td></tr>
 
37
<tr><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><b><a href="qudpsocket.html#dtor.QUdpSocket">~QUdpSocket</a></b> ()</td></tr>
 
38
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qudpsocket.html#bind">bind</a></b> ( const QHostAddress &amp; <i>address</i>, quint16 <i>port</i> )</td></tr>
 
39
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qudpsocket.html#bind-2">bind</a></b> ( const QHostAddress &amp; <i>address</i>, quint16 <i>port</i>, BindMode <i>mode</i> )</td></tr>
 
40
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qudpsocket.html#bind-3">bind</a></b> ( quint16 <i>port</i> = 0 )</td></tr>
 
41
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qudpsocket.html#bind-4">bind</a></b> ( quint16 <i>port</i>, BindMode <i>mode</i> )</td></tr>
 
42
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qudpsocket.html#hasPendingDatagrams">hasPendingDatagrams</a></b> () const</td></tr>
 
43
<tr><td class="memItemLeft" align="right" valign="top">qint64 </td><td class="memItemRight" valign="bottom"><b><a href="qudpsocket.html#pendingDatagramSize">pendingDatagramSize</a></b> () const</td></tr>
 
44
<tr><td class="memItemLeft" align="right" valign="top">qint64 </td><td class="memItemRight" valign="bottom"><b><a href="qudpsocket.html#readDatagram">readDatagram</a></b> ( char * <i>data</i>, qint64 <i>maxSize</i>, QHostAddress * <i>address</i> = 0, quint16 * <i>port</i> = 0 )</td></tr>
 
45
<tr><td class="memItemLeft" align="right" valign="top">qint64 </td><td class="memItemRight" valign="bottom"><b><a href="qudpsocket.html#writeDatagram">writeDatagram</a></b> ( const char * <i>data</i>, qint64 <i>size</i>, const QHostAddress &amp; <i>address</i>, quint16 <i>port</i> )</td></tr>
 
46
<tr><td class="memItemLeft" align="right" valign="top">qint64 </td><td class="memItemRight" valign="bottom"><b><a href="qudpsocket.html#writeDatagram-2">writeDatagram</a></b> ( const QByteArray &amp; <i>datagram</i>, const QHostAddress &amp; <i>host</i>, quint16 <i>port</i> )</td></tr>
 
47
</table>
 
48
<ul>
 
49
<li><div bar="2" class="fn"></div>32 public functions inherited from <a href="qabstractsocket.html#public-functions">QAbstractSocket</a></li>
 
50
<li><div bar="2" class="fn"></div>33 public functions inherited from <a href="qiodevice.html#public-functions">QIODevice</a></li>
 
51
<li><div bar="2" class="fn"></div>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
48
52
</ul>
49
53
<h3>Additional Inherited Members</h3>
50
54
<ul>
54
58
<li><div class="fn"></div>4 signals inherited from <a href="qiodevice.html#signals">QIODevice</a></li>
55
59
<li><div class="fn"></div>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
56
60
<li><div class="fn"></div>5 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
57
 
<li><div class="fn"></div>7 protected functions inherited from <a href="qabstractsocket.html#protected-functions">QAbstractSocket</a></li>
 
61
<li><div class="fn"></div>10 protected functions inherited from <a href="qabstractsocket.html#protected-functions">QAbstractSocket</a></li>
58
62
<li><div class="fn"></div>5 protected functions inherited from <a href="qiodevice.html#protected-functions">QIODevice</a></li>
59
63
<li><div class="fn"></div>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
60
64
<li><div class="fn"></div>2 protected slots inherited from <a href="qabstractsocket.html#protected-slots">QAbstractSocket</a></li>
67
71
<p>The most common way to use this class is to bind to an address and port using <a href="qudpsocket.html#bind">bind</a>(), then call <a href="qudpsocket.html#writeDatagram">writeDatagram</a>() and <a href="qudpsocket.html#readDatagram">readDatagram</a>() to transfer data. If you want to use the standard <a href="qiodevice.html">QIODevice</a> functions <a href="qiodevice.html#read">read</a>(), <a href="qiodevice.html#readLine">readLine</a>(), <a href="qiodevice.html#write">write</a>(), etc., you must first connect the socket directly to a peer by calling <a href="qabstractsocket.html#connectToHost">connectToHost</a>().</p>
68
72
<p>The socket emits the <a href="qiodevice.html#bytesWritten">bytesWritten</a>() signal every time a datagram is written to the network. If you just want to send datagrams, you don't need to call <a href="qudpsocket.html#bind">bind</a>().</p>
69
73
<p>The <a href="qiodevice.html#readyRead">readyRead</a>() signal is emitted whenever datagrams arrive. In that case, <a href="qudpsocket.html#hasPendingDatagrams">hasPendingDatagrams</a>() returns true. Call <a href="qudpsocket.html#pendingDatagramSize">pendingDatagramSize</a>() to obtain the size of the first pending datagram, and <a href="qudpsocket.html#readDatagram">readDatagram</a>() to read it.</p>
 
74
<p><b>Note:</b> An incoming datagram should be read when you receive the <a href="qiodevice.html#readyRead">readyRead</a>() signal, otherwise this signal will not be emitted for the next datagram.</p>
70
75
<p>Example:</p>
71
76
<pre> void Server::initSocket()
72
77
 {
96
101
<p>See also <a href="qtcpsocket.html">QTcpSocket</a>.</p>
97
102
<hr />
98
103
<h2>Member Type Documentation</h2>
 
104
<a name="//apple_ref/cpp/tag/QUdpSocket/BindFlag" />
 
105
<a name="//apple_ref/cpp/econst/QUdpSocket/ShareAddress" />
 
106
<a name="//apple_ref/cpp/econst/QUdpSocket/DontShareAddress" />
 
107
<a name="//apple_ref/cpp/econst/QUdpSocket/ReuseAddressHint" />
 
108
<a name="//apple_ref/cpp/econst/QUdpSocket/DefaultForPlatform" />
 
109
<a name="//apple_ref/cpp/tdef/QUdpSocket/BindMode" />
99
110
<h3 class="flags"><a name="BindFlag-enum"></a>enum QUdpSocket::BindFlag<br />flags QUdpSocket::BindMode</h3>
100
111
<p>This enum describes the different flags you can pass to modify the behavior of <a href="qudpsocket.html#bind">QUdpSocket::bind</a>().</p>
101
 
<p><table border="1" cellpadding="2" cellspacing="1" width="100%">
 
112
<p><b>Note:</b> On Symbian OS bind flags behaviour depends on process capabilties. If process has NetworkControl capability, the bind attempt with ReuseAddressHint will always succeed even if the address and port is already bound by another socket with any flags. If process does not have NetworkControl capability, the bind attempt to address and port already bound by another socket will always fail.</p>
 
113
<p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%">
102
114
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
103
115
<tr><td valign="top"><tt>QUdpSocket::ShareAddress</tt></td><td align="center" valign="top"><tt>0x1</tt></td><td valign="top">Allow other services to bind to the same address and port. This is useful when multiple processes share the load of a single service by listening to the same address and port (e.g&#x2e;, a web server with several pre-forked listeners can greatly improve response time). However, because any service is allowed to rebind, this option is subject to certain security considerations. Note that by combining this option with ReuseAddressHint, you will also allow your service to rebind an existing shared address. On Unix, this is equivalent to the SO_REUSEADDR socket option. On Windows, this option is ignored.</td></tr>
104
116
<tr><td valign="top"><tt>QUdpSocket::DontShareAddress</tt></td><td align="center" valign="top"><tt>0x2</tt></td><td valign="top">Bind the address and port exclusively, so that no other services are allowed to rebind. By passing this option to <a href="qudpsocket.html#bind">QUdpSocket::bind</a>(), you are guaranteed that on successs, your service is the only one that listens to the address and port. No services are allowed to rebind, even if they pass ReuseAddressHint. This option provides more security than ShareAddress, but on certain operating systems, it requires you to run the server with administrator privileges. On Unix and Mac OS X, not sharing is the default behavior for binding an address and port, so this option is ignored. On Windows, this option uses the SO_EXCLUSIVEADDRUSE socket option.</td></tr>
109
121
<p>The BindMode type is a typedef for <a href="qflags.html">QFlags</a>&lt;BindFlag&gt;. It stores an OR combination of BindFlag values.</p>
110
122
<hr />
111
123
<h2>Member Function Documentation</h2>
 
124
<a name="//apple_ref/cpp/instm/QUdpSocket/QUdpSocket" />
112
125
<h3 class="fn"><a name="QUdpSocket"></a>QUdpSocket::QUdpSocket ( <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
113
126
<p>Creates a <a href="qudpsocket.html">QUdpSocket</a> object.</p>
114
127
<p><i>parent</i> is passed to the <a href="qobject.html">QObject</a> constructor.</p>
115
128
<p>See also <a href="qabstractsocket.html#socketType">socketType</a>().</p>
 
129
<a name="//apple_ref/cpp/instm/QUdpSocket/~QUdpSocket" />
116
130
<h3 class="fn"><a name="dtor.QUdpSocket"></a>QUdpSocket::~QUdpSocket ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
117
131
<p>Destroys the socket, closing the connection if necessary.</p>
118
132
<p>See also <a href="qabstractsocket.html#close">close</a>().</p>
 
133
<a name="//apple_ref/cpp/instm/QUdpSocket/bind" />
119
134
<h3 class="fn"><a name="bind"></a>bool QUdpSocket::bind ( const <a href="qhostaddress.html">QHostAddress</a> &amp; <i>address</i>, <a href="qtglobal.html#quint16-typedef">quint16</a> <i>port</i> )</h3>
120
135
<p>Binds this socket to the address <i>address</i> and the port <i>port</i>. When bound, the signal <a href="qiodevice.html#readyRead">readyRead</a>() is emitted whenever a UDP datagram arrives on the specified address and port. This function is useful to write UDP servers.</p>
121
136
<p>On success, the functions returns true and the socket enters <a href="qabstractsocket.html#SocketState-enum">BoundState</a>; otherwise it returns false.</p>
132
147
<p>This is an overloaded function.</p>
133
148
<p>Binds to <a href="qhostaddress.html">QHostAddress</a>:Any on port <i>port</i>, using the <a href="qudpsocket.html#BindFlag-enum">BindMode</a> <i>mode</i>.</p>
134
149
<p>This function was introduced in Qt 4.1.</p>
 
150
<a name="//apple_ref/cpp/instm/QUdpSocket/hasPendingDatagrams" />
135
151
<h3 class="fn"><a name="hasPendingDatagrams"></a>bool QUdpSocket::hasPendingDatagrams () const</h3>
136
152
<p>Returns true if at least one datagram is waiting to be read; otherwise returns false.</p>
137
153
<p>See also <a href="qudpsocket.html#pendingDatagramSize">pendingDatagramSize</a>() and <a href="qudpsocket.html#readDatagram">readDatagram</a>().</p>
 
154
<a name="//apple_ref/cpp/instm/QUdpSocket/pendingDatagramSize" />
138
155
<h3 class="fn"><a name="pendingDatagramSize"></a><a href="qtglobal.html#qint64-typedef">qint64</a> QUdpSocket::pendingDatagramSize () const</h3>
139
156
<p>Returns the size of the first pending UDP datagram. If there is no datagram available, this function returns -1.</p>
140
157
<p>See also <a href="qudpsocket.html#hasPendingDatagrams">hasPendingDatagrams</a>() and <a href="qudpsocket.html#readDatagram">readDatagram</a>().</p>
 
158
<a name="//apple_ref/cpp/instm/QUdpSocket/readDatagram" />
141
159
<h3 class="fn"><a name="readDatagram"></a><a href="qtglobal.html#qint64-typedef">qint64</a> QUdpSocket::readDatagram ( char * <i>data</i>, <a href="qtglobal.html#qint64-typedef">qint64</a> <i>maxSize</i>, <a href="qhostaddress.html">QHostAddress</a> * <i>address</i> = 0, <a href="qtglobal.html#quint16-typedef">quint16</a> * <i>port</i> = 0 )</h3>
142
160
<p>Receives a datagram no larger than <i>maxSize</i> bytes and stores it in <i>data</i>. The sender's host address and port is stored in *<i>address</i> and *<i>port</i> (unless the pointers are 0).</p>
143
161
<p>Returns the size of the datagram on success; otherwise returns -1.</p>
144
162
<p>If <i>maxSize</i> is too small, the rest of the datagram will be lost. To avoid loss of data, call <a href="qudpsocket.html#pendingDatagramSize">pendingDatagramSize</a>() to determine the size of the pending datagram before attempting to read it. If <i>maxSize</i> is 0, the datagram will be discarded.</p>
145
163
<p>See also <a href="qudpsocket.html#writeDatagram">writeDatagram</a>(), <a href="qudpsocket.html#hasPendingDatagrams">hasPendingDatagrams</a>(), and <a href="qudpsocket.html#pendingDatagramSize">pendingDatagramSize</a>().</p>
 
164
<a name="//apple_ref/cpp/instm/QUdpSocket/writeDatagram" />
146
165
<h3 class="fn"><a name="writeDatagram"></a><a href="qtglobal.html#qint64-typedef">qint64</a> QUdpSocket::writeDatagram ( const char * <i>data</i>, <a href="qtglobal.html#qint64-typedef">qint64</a> <i>size</i>, const <a href="qhostaddress.html">QHostAddress</a> &amp; <i>address</i>, <a href="qtglobal.html#quint16-typedef">quint16</a> <i>port</i> )</h3>
147
166
<p>Sends the datagram at <i>data</i> of size <i>size</i> to the host address <i>address</i> at port <i>port</i>. Returns the number of bytes sent on success; otherwise returns -1.</p>
148
167
<p>Datagrams are always written as one block. The maximum size of a datagram is highly platform-dependent, but can be as low as 8192 bytes. If the datagram is too large, this function will return -1 and <a href="qabstractsocket.html#error">error</a>() will return <a href="qabstractsocket.html#SocketError-enum">DatagramTooLargeError</a>.</p>
149
168
<p>Sending datagrams larger than 512 bytes is in general disadvised, as even if they are sent successfully, they are likely to be fragmented by the IP layer before arriving at their final destination.</p>
 
169
<p><b>Warning:</b> In S60 5.0 and earlier versions, the writeDatagram return value is not reliable for large datagrams.</p>
150
170
<p><b>Warning:</b> Calling this function on a connected UDP socket may result in an error and no packet being sent. If you are using a connected socket, use <a href="qiodevice.html#write">write</a>() to send datagrams.</p>
151
171
<p>See also <a href="qudpsocket.html#readDatagram">readDatagram</a>() and <a href="qiodevice.html#write">write</a>().</p>
152
172
<h3 class="fn"><a name="writeDatagram-2"></a><a href="qtglobal.html#qint64-typedef">qint64</a> QUdpSocket::writeDatagram ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>datagram</i>, const <a href="qhostaddress.html">QHostAddress</a> &amp; <i>host</i>, <a href="qtglobal.html#quint16-typedef">quint16</a> <i>port</i> )</h3>
154
174
<p>Sends the datagram <i>datagram</i> to the host address <i>host</i> and at port <i>port</i>.</p>
155
175
<p /><address><hr /><div align="center">
156
176
<table width="100%" cellspacing="0" border="0"><tr class="address">
157
 
<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
158
 
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
159
 
<td width="30%" align="right"><div align="right">Qt 4.5.2</div></td>
160
 
</tr></table></div></address></body>
 
177
<td width="40%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
 
178
<td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
179
<td width="40%" align="right"><div align="right">Qt 4.6.0</div></td>
 
180
<script type="text/javascript" src="http://www.google.com/jsapi"></script><script type="text/javascript">google.load("elements", "1", {packages: "transliteration"});</script><script type="text/javascript" src="http://www.google.com/coop/cse/t13n?form=cse-search-box&t13n_langs=en"></script><script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script></tr></table></div></address></body>
161
181
</html>