<?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[0x00 per TCP Socket senden]]></title><description><![CDATA[<p>Hi,<br />
ich bekomme es einfach nicht hin die 0x00 per tcp zu senden.. als ob der die einfach überspringt...</p>
<p>mein code</p>
<pre><code>int t1 = 0xf2;
int t3 = 0xff;

char t2[] = {0xf2, 0x00};
//char *t2= (char) 0;
int left = sizeof(t1);

char *data1 = (char*)&amp;t1;
char *data3 = (char*)&amp;t3;
//char *data2 = (char*)&amp;t2;

char icxfull[21];

strcat(icxfull, t2);
//strcat(icxfull, data2);

strcat(icxfull, icx);
strcat(icxfull, data3);

.
.
.

.
..

n = write(sockfd, icxfull, sizeof(icxfull));
</code></pre>
<p>über wireshark sieht das ganze dann so aus...</p>
<p>F2 30 30 34 ......</p>
<p>und aussehen soll es</p>
<p>F2 00 30 30 34....</p>
<p>dh der schickt die 00 garnicht</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/334099/0x00-per-tcp-socket-senden</link><generator>RSS for Node</generator><lastBuildDate>Sat, 25 Apr 2026 10:27:24 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/334099.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 21 Aug 2015 13:21:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 0x00 per TCP Socket senden on Fri, 21 Aug 2015 13:21:04 GMT]]></title><description><![CDATA[<p>Hi,<br />
ich bekomme es einfach nicht hin die 0x00 per tcp zu senden.. als ob der die einfach überspringt...</p>
<p>mein code</p>
<pre><code>int t1 = 0xf2;
int t3 = 0xff;

char t2[] = {0xf2, 0x00};
//char *t2= (char) 0;
int left = sizeof(t1);

char *data1 = (char*)&amp;t1;
char *data3 = (char*)&amp;t3;
//char *data2 = (char*)&amp;t2;

char icxfull[21];

strcat(icxfull, t2);
//strcat(icxfull, data2);

strcat(icxfull, icx);
strcat(icxfull, data3);

.
.
.

.
..

n = write(sockfd, icxfull, sizeof(icxfull));
</code></pre>
<p>über wireshark sieht das ganze dann so aus...</p>
<p>F2 30 30 34 ......</p>
<p>und aussehen soll es</p>
<p>F2 00 30 30 34....</p>
<p>dh der schickt die 00 garnicht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2465063</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2465063</guid><dc:creator><![CDATA[mitch_m]]></dc:creator><pubDate>Fri, 21 Aug 2015 13:21:04 GMT</pubDate></item><item><title><![CDATA[Reply to 0x00 per TCP Socket senden on Fri, 21 Aug 2015 13:27:02 GMT]]></title><description><![CDATA[<p>Was bedeutet '\0' in einem C-String?<br />
Was macht strcat dann wohl mit 0?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2465067</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2465067</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Fri, 21 Aug 2015 13:27:02 GMT</pubDate></item><item><title><![CDATA[Reply to 0x00 per TCP Socket senden on Fri, 21 Aug 2015 13:29:08 GMT]]></title><description><![CDATA[<p>Erstens ist das krass C hier, das hat nichts mit C++ zu tun.<br />
Zweitens: ließ mal die <a href="http://linux.die.net/man/3/strcat" rel="nofollow">manpage</a> zu strcat durch:</p>
<p>strcat(3) schrieb:</p>
<blockquote>
<p>The strcat() function appends the src string to the dest string, overwriting the terminating null byte ('\0') at the end of dest</p>
</blockquote>
<p>Für sowas nimmt man besser <code>memcpy</code> oder gar <code>memmove</code> , weil man bei sich überlappenden Buffern keine Sorge haben braucht, dass man da was kaputtschreibt. Außerdem sind diese hoch optimiert - dieser Programmierer hier hat versucht, eine schnellere Implementierung hinzugekommen, mit AVX und SSE, und ist bisher gescheitert. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Spricht: Der würde schon gerne die 0x00 senden, aber weil du die nicht in den Buffer tust, kann er sie auch nicht mitsenden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2465069</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2465069</guid><dc:creator><![CDATA[dachschaden]]></dc:creator><pubDate>Fri, 21 Aug 2015 13:29:08 GMT</pubDate></item><item><title><![CDATA[Reply to 0x00 per TCP Socket senden on Sat, 22 Aug 2015 07:57:38 GMT]]></title><description><![CDATA[<p>mitch_m schrieb:</p>
<blockquote>
<p>F2 30 30 34 ......</p>
<p>und aussehen soll es</p>
<p>F2 00 30 30 34....</p>
<p>dh der schickt die 00 garnicht</p>
</blockquote>
<p>Du schickst ja auch gar keine 0. Das haettest du mit einem Debugger in 20s rausgefunden, danke das du die Zeit von anderen verschwendest.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2465140</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2465140</guid><dc:creator><![CDATA[TGGC]]></dc:creator><pubDate>Sat, 22 Aug 2015 07:57:38 GMT</pubDate></item><item><title><![CDATA[Reply to 0x00 per TCP Socket senden on Mon, 28 Sep 2015 14:32:13 GMT]]></title><description><![CDATA[<p>Hallo:)</p>
<p>etwas her.. aber bin wieder dran...</p>
<p>wie muss denn der Befehl lauten?</p>
<p>memmove(icxfull, 0x00, 0); ???</p>
<p>denke nicht... das funktioniert nämlich nciht:)</p>
<p>bin newby... sorry hehe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2469256</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2469256</guid><dc:creator><![CDATA[mitch_m]]></dc:creator><pubDate>Mon, 28 Sep 2015 14:32:13 GMT</pubDate></item><item><title><![CDATA[Reply to 0x00 per TCP Socket senden on Mon, 28 Sep 2015 14:52:21 GMT]]></title><description><![CDATA[<p>Definiere &quot;das funktioniert nämlich nciht&quot;.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2469257</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2469257</guid><dc:creator><![CDATA[TGGC]]></dc:creator><pubDate>Mon, 28 Sep 2015 14:52:21 GMT</pubDate></item><item><title><![CDATA[Reply to 0x00 per TCP Socket senden on Mon, 28 Sep 2015 14:53:00 GMT]]></title><description><![CDATA[<p>mitch_m schrieb:</p>
<blockquote>
<p>Hallo:)</p>
<p>etwas her.. aber bin wieder dran...</p>
<p>wie muss denn der Befehl lauten?</p>
<p>memmove(icxfull, 0x00, 0); ???</p>
<p>denke nicht... das funktioniert nämlich nciht:)</p>
<p>bin newby... sorry hehe</p>
</blockquote>
<p><a href="http://man7.org/linux/man-pages/man3/memmove.3.html" rel="nofollow">http://man7.org/linux/man-pages/man3/memmove.3.html</a></p>
<pre><code>#include &lt;string.h&gt;

       void *memmove(void *dest, const void *src, size_t n);

---

       The memmove() function copies n bytes from memory area src to memory
       area dest.  The memory areas may overlap: copying takes place as
       though the bytes in src are first copied into a temporary array that
       does not overlap src or dest, and the bytes are then copied from the
       temporary array to dest.
</code></pre>
<p>Also:<br />
memmove(Zieladresse, Quelladresse, Bytegröße)<br />
z.B.</p>
<pre><code>char dest[5];
char src[2];
// mit Daten befüllen ... z.B. src[0]=10; src[1]=12;
memmove(dest, src, 2);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2469258</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2469258</guid><dc:creator><![CDATA[4444444444444444444444444]]></dc:creator><pubDate>Mon, 28 Sep 2015 14:53:00 GMT</pubDate></item><item><title><![CDATA[Reply to 0x00 per TCP Socket senden on Mon, 28 Sep 2015 18:51:51 GMT]]></title><description><![CDATA[<p>Oh Mann. Was für ein Code. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>Erstens nutzt du String Funktionen welche das String Ende mittels einer 0 finden. Kein Wunder dass die 0 fehlt.</p>
<p>Zeitens rufst du strcat() auf einem nicht initialisierten String auf. Das knallt irgentwann.</p>
<p>Drittens achtest du nicht auf Speicheralignment. Unter Windows gibst hierfür die htons() Funktion.</p>
<p>Viertens verschickst du sizeof(icxfull) Bytes. Also vermutlich exakt <strong>24</strong> Bytes. Das ist erstens fehlerhaft weil deine Daten nicht so lang sind und weil zweitens du padding Bytes missachtest.</p>
<p>BITTE NIMM EINEN DEBUGGER und schau dir genau was was du da hingerotzt hast!!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2469278</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2469278</guid><dc:creator><![CDATA[Bitte ein Bit]]></dc:creator><pubDate>Mon, 28 Sep 2015 18:51:51 GMT</pubDate></item><item><title><![CDATA[Reply to 0x00 per TCP Socket senden on Tue, 29 Sep 2015 06:47:45 GMT]]></title><description><![CDATA[<pre><code>char t2[1] = {0x00};
char *data2;
memmove (data2,t2,1); 
strcat(icxfull, data2);
</code></pre>
<p>so in etwa?</p>
<p>JA!!! der Code ist etwas durcheinander... aber bis dato versuche ich nichts anderes außer diese paar byts zu senden....</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2469314</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2469314</guid><dc:creator><![CDATA[mitch_m]]></dc:creator><pubDate>Tue, 29 Sep 2015 06:47:45 GMT</pubDate></item><item><title><![CDATA[Reply to 0x00 per TCP Socket senden on Tue, 29 Sep 2015 07:24:37 GMT]]></title><description><![CDATA[<p>mitch_m schrieb:</p>
<blockquote>
<p>JA!!! der Code ist etwas durcheinander... aber bis dato versuche ich nichts anderes außer diese paar byts zu senden....</p>
</blockquote>
<p>Dann versuch doch bitte zu verstehen. Du hast wieder genau das falsch gemacht was dir schon erklärt wurde.</p>
<pre><code>char t2[1] = {0x00}; //Array der Größe eins, enthält nur ein Nullbyte
char *data2; //Pointer der noch kein Ziel hat, zeigt auf eine undefineirte Adresse
memmove (data2,t2,1); //Schiebt das eine Byte das t2 enthält an die Adresse auf die data2 zeigt, also irgendwo ins Nirgendwo 
strcat(icxfull, data2);//Behält den Inhalt von icxfull(undefiniert) bis zum ersten Nullbyte bei, hängt dann alle Zeichen von data2 an bis es ein Nullybte findet.
</code></pre>
<p>Merkst du jetzt wo das Problem ist?<br />
Du verwendest uninitialisierte, zufällige Variablen und verwendest eine Funktion zum Kopieren die alles kopieren kann außer Nullbytes.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2469321</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2469321</guid><dc:creator><![CDATA[DarkShadow44]]></dc:creator><pubDate>Tue, 29 Sep 2015 07:24:37 GMT</pubDate></item><item><title><![CDATA[Reply to 0x00 per TCP Socket senden on Tue, 29 Sep 2015 08:05:55 GMT]]></title><description><![CDATA[<p>Habe es nun hinbekommen</p>
<pre><code>char icxfull[19] = {&quot;00004000F202F20180&quot;};

icxfull[0] = 0xF2;
icxfull[1] = 0x00;
icxfull[18] = 0xFF;
</code></pre>
<p>wieso mache ich mir es so kompliziert?!:)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2469324</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2469324</guid><dc:creator><![CDATA[mitch_m]]></dc:creator><pubDate>Tue, 29 Sep 2015 08:05:55 GMT</pubDate></item><item><title><![CDATA[Reply to 0x00 per TCP Socket senden on Tue, 29 Sep 2015 11:02:13 GMT]]></title><description><![CDATA[<p>Wie wärs mit</p>
<pre><code>char icxfull[] = &quot;\xF2\x00&quot;&quot;004000F202F20180\xFF&quot;;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2469339</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2469339</guid><dc:creator><![CDATA[DarkShadow44]]></dc:creator><pubDate>Tue, 29 Sep 2015 11:02:13 GMT</pubDate></item><item><title><![CDATA[Reply to 0x00 per TCP Socket senden on Tue, 29 Sep 2015 14:25:19 GMT]]></title><description><![CDATA[<p>Oder gar</p>
<pre><code>char Packet[] = { 0xf2, 0x00, ..., 0xff };
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2469360</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2469360</guid><dc:creator><![CDATA[DocShoe]]></dc:creator><pubDate>Tue, 29 Sep 2015 14:25:19 GMT</pubDate></item></channel></rss>