<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Creating and sending crafted packets]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">I have been writing an application that creates a QByteArray representing a packet of data that I carefully craft in order to control the parameters present in a UDP Header (according to <a href="http://en.wikipedia.org/wiki/User_Datagram_Protocol#IPv4_Pseudo_Header" target="_blank" rel="noopener noreferrer nofollow ugc">http://en.wikipedia.org/wiki/User_Datagram_Protocol#IPv4_Pseudo_Header</a>)</p>
<p dir="auto">I was wondering if Qt allows me to simply send a QByteArray without asking for any binding, source/destination port or address, etc.<br />
Long story short, I want to be able to control every single bit (at least up to the Internet Layer) within a packet that is sent from the socket.</p>
<p dir="auto">Ideally, I'd like to have something like this:</p>
<p dir="auto">@<br />
QAbstractSocket *testSocket;<br />
testSocket = new QAbstractSocket(QAbstractSocket::UdpSocket, this);</p>
<p dir="auto">testSocket-&gt;write(dataPacket);    // where dataPacket is a QByteArray<br />
//containing the packet crafted<br />
@</p>
<p dir="auto">Anyone knows something about it?</p>
]]></description><link>https://forum.qt.io/topic/26065/creating-and-sending-crafted-packets</link><generator>RSS for Node</generator><lastBuildDate>Sun, 19 Apr 2026 02:02:15 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/26065.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 10 Apr 2013 14:42:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Creating and sending crafted packets on Sun, 14 Apr 2013 11:33:23 GMT]]></title><description><![CDATA[<p dir="auto">I do not think that will work: They will do the IP for you, too, just like the Qt classes built on top of them.</p>
<p dir="auto">Basically you can not use anything that requires an IP address to create;) That is a strong indication that the TCP/IP headers will be handled for you.</p>
]]></description><link>https://forum.qt.io/post/173650</link><guid isPermaLink="true">https://forum.qt.io/post/173650</guid><dc:creator><![CDATA[tobias.hunger]]></dc:creator><pubDate>Sun, 14 Apr 2013 11:33:23 GMT</pubDate></item><item><title><![CDATA[Reply to Creating and sending crafted packets on Fri, 12 Apr 2013 11:50:53 GMT]]></title><description><![CDATA[<p dir="auto">Well, I already have some experience in programming with raw C/C++, so I thought I could use a generic socket coming from:</p>
<p dir="auto">@#include &lt;sys/socket.h&gt;    // or #include "sys/socket.h", don't really remember right now :P@</p>
<p dir="auto">And either use the ip packet struct to send exactly what I want, or send a packet formed of an array of char[].<br />
This is all theoretic, I did not get to try any of this...yet :P</p>
]]></description><link>https://forum.qt.io/post/173461</link><guid isPermaLink="true">https://forum.qt.io/post/173461</guid><dc:creator><![CDATA[QTDavid]]></dc:creator><pubDate>Fri, 12 Apr 2013 11:50:53 GMT</pubDate></item><item><title><![CDATA[Reply to Creating and sending crafted packets on Fri, 12 Apr 2013 11:35:10 GMT]]></title><description><![CDATA[<p dir="auto">Most likely both:-) You will need some special OS functions to send crafted packages, and you will most likely also need elevated privileges to be allowed to use them.</p>
]]></description><link>https://forum.qt.io/post/173457</link><guid isPermaLink="true">https://forum.qt.io/post/173457</guid><dc:creator><![CDATA[tobias.hunger]]></dc:creator><pubDate>Fri, 12 Apr 2013 11:35:10 GMT</pubDate></item><item><title><![CDATA[Reply to Creating and sending crafted packets on Fri, 12 Apr 2013 10:26:57 GMT]]></title><description><![CDATA[<p dir="auto">I'll have a look at that thank you.<br />
With OS-functionality do you mean that crafting packets can only be done by the OS, or the application requires root (or administrator) permissions?</p>
]]></description><link>https://forum.qt.io/post/173447</link><guid isPermaLink="true">https://forum.qt.io/post/173447</guid><dc:creator><![CDATA[QTDavid]]></dc:creator><pubDate>Fri, 12 Apr 2013 10:26:57 GMT</pubDate></item><item><title><![CDATA[Reply to Creating and sending crafted packets on Thu, 11 Apr 2013 14:59:23 GMT]]></title><description><![CDATA[<p dir="auto">I doubt that you will find anything in the standards... you will need OS-functionality or a special purpose library for this.</p>
]]></description><link>https://forum.qt.io/post/173364</link><guid isPermaLink="true">https://forum.qt.io/post/173364</guid><dc:creator><![CDATA[tobias.hunger]]></dc:creator><pubDate>Thu, 11 Apr 2013 14:59:23 GMT</pubDate></item><item><title><![CDATA[Reply to Creating and sending crafted packets on Thu, 11 Apr 2013 12:22:26 GMT]]></title><description><![CDATA[<p dir="auto">Ok, thanks a lot.<br />
I'll try some more C++ standard stuff.</p>
]]></description><link>https://forum.qt.io/post/173336</link><guid isPermaLink="true">https://forum.qt.io/post/173336</guid><dc:creator><![CDATA[QTDavid]]></dc:creator><pubDate>Thu, 11 Apr 2013 12:22:26 GMT</pubDate></item><item><title><![CDATA[Reply to Creating and sending crafted packets on Wed, 10 Apr 2013 19:30:52 GMT]]></title><description><![CDATA[<p dir="auto">No, you can send arbitrary data, but the tcp/ip stack adds its own headers.</p>
]]></description><link>https://forum.qt.io/post/173256</link><guid isPermaLink="true">https://forum.qt.io/post/173256</guid><dc:creator><![CDATA[tobias.hunger]]></dc:creator><pubDate>Wed, 10 Apr 2013 19:30:52 GMT</pubDate></item></channel></rss>