<?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[Sockets]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe eine Frage zu Sockets.</p>
<pre><code class="language-cpp">int Error;
 	WORD wVersionRequested;
	WSADATA wsaData;
	int err;
	wVersionRequested = MAKEWORD( 2, 2 );

	err = WSAStartup( wVersionRequested, &amp;wsaData );
	if ( err != 0 )
     {
    		/* Tell the user that we could not find a usable */
    		/* WinSock DLL.                                  */
    		return;
	}

	/* Confirm that the WinSock DLL supports 2.2.*/
	/* Note that if the DLL supports versions later    */
	/* than 2.2 in addition to 2.2, it will still return */
	/* 2.2 in wVersion since that is the version we      */
	/* requested.                                        */

	if ( LOBYTE( wsaData.wVersion ) != 2 || HIBYTE( wsaData.wVersion ) != 2 )
     {
    		/* Tell the user that we could not find a usable */
    		/* WinSock DLL.                                  */
    		WSACleanup( );
    		return;
	}
  	Socket = socket(AF_INET, SOCK_RAW, IPPROTO_UDP);
  	if (Socket == INVALID_SOCKET)
  	{
    		Error = WSAGetLastError();
     	Application-&gt;MessageBoxA(&quot;Socked Error&quot;,&quot;ERROR&quot;,MB_OK);
     }
</code></pre>
<p>Soweit bin ich da schon, bevor ich nun mit send / sendto etwas senden<br />
kann muss ich ja noch irgendwie den Traget Port sowie die Target IP angeben.<br />
Wo und wie stell ich das an?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/198040/sockets</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 02:59:18 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/198040.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 17 Nov 2007 15:53:58 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Sockets on Sat, 17 Nov 2007 15:53:58 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe eine Frage zu Sockets.</p>
<pre><code class="language-cpp">int Error;
 	WORD wVersionRequested;
	WSADATA wsaData;
	int err;
	wVersionRequested = MAKEWORD( 2, 2 );

	err = WSAStartup( wVersionRequested, &amp;wsaData );
	if ( err != 0 )
     {
    		/* Tell the user that we could not find a usable */
    		/* WinSock DLL.                                  */
    		return;
	}

	/* Confirm that the WinSock DLL supports 2.2.*/
	/* Note that if the DLL supports versions later    */
	/* than 2.2 in addition to 2.2, it will still return */
	/* 2.2 in wVersion since that is the version we      */
	/* requested.                                        */

	if ( LOBYTE( wsaData.wVersion ) != 2 || HIBYTE( wsaData.wVersion ) != 2 )
     {
    		/* Tell the user that we could not find a usable */
    		/* WinSock DLL.                                  */
    		WSACleanup( );
    		return;
	}
  	Socket = socket(AF_INET, SOCK_RAW, IPPROTO_UDP);
  	if (Socket == INVALID_SOCKET)
  	{
    		Error = WSAGetLastError();
     	Application-&gt;MessageBoxA(&quot;Socked Error&quot;,&quot;ERROR&quot;,MB_OK);
     }
</code></pre>
<p>Soweit bin ich da schon, bevor ich nun mit send / sendto etwas senden<br />
kann muss ich ja noch irgendwie den Traget Port sowie die Target IP angeben.<br />
Wo und wie stell ich das an?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1404946</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1404946</guid><dc:creator><![CDATA[hermes]]></dc:creator><pubDate>Sat, 17 Nov 2007 15:53:58 GMT</pubDate></item><item><title><![CDATA[Reply to Sockets on Sat, 17 Nov 2007 17:28:49 GMT]]></title><description><![CDATA[<p>sendto kann mit verbindungslosen protokollen (wie z.B. UDP, wie bei Dir) verwedendet werden.</p>
<p>Das 'to' argument gibt die ip addr. und den port an.</p>
<p>Hier findest Du noch mehr Infos:<br />
<a href="http://msdn2.microsoft.com/en-us/library/ms740148.aspx" rel="nofollow">http://msdn2.microsoft.com/en-us/library/ms740148.aspx</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1404999</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1404999</guid><dc:creator><![CDATA[simon.gysi]]></dc:creator><pubDate>Sat, 17 Nov 2007 17:28:49 GMT</pubDate></item><item><title><![CDATA[Reply to Sockets on Sat, 17 Nov 2007 18:47:39 GMT]]></title><description><![CDATA[<p>Ah ja, danke Dir.</p>
<p>Nun möchte ich anstatt IPPROTO_UDP einen ARP Senden, der taucht<br />
als protocol nicht auf.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1405039</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1405039</guid><dc:creator><![CDATA[hermes]]></dc:creator><pubDate>Sat, 17 Nov 2007 18:47:39 GMT</pubDate></item><item><title><![CDATA[Reply to Sockets on Sun, 18 Nov 2007 02:23:23 GMT]]></title><description><![CDATA[<p>Ist das nicht ICMP? Das geht über die socket API AFAIK nicht.<br />
Kann dir aber leider auch keinen Tip geben welche API du dafür verwenden musst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1405143</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1405143</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Sun, 18 Nov 2007 02:23:23 GMT</pubDate></item><item><title><![CDATA[Reply to Sockets on Sun, 18 Nov 2007 03:27:12 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Nein, ARP ist nicht ICMP. Soweit ich weiss, liegt ICMP auf der gleichen Ebene wie IP, eine Ebene unter TCP im ISO/OSI-Referenzmodell. ARP liegt aber eine Ebene unter IP ist fuer die Aufloesung von IP-Adresse zu MAC-Adresse verantwortlich.<br />
Vielleicht hilft das hier weiter:<br />
<a href="http://msdn2.microsoft.com/en-us/library/aa366358.aspx" rel="nofollow">http://msdn2.microsoft.com/en-us/library/aa366358.aspx</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1405147</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1405147</guid><dc:creator><![CDATA[GeNeTiX]]></dc:creator><pubDate>Sun, 18 Nov 2007 03:27:12 GMT</pubDate></item><item><title><![CDATA[Reply to Sockets on Mon, 19 Nov 2007 01:06:36 GMT]]></title><description><![CDATA[<p>hustbaer schrieb:</p>
<blockquote>
<p>Ist das nicht ICMP? Das geht über die socket API AFAIK nicht.<br />
Kann dir aber leider auch keinen Tip geben welche API du dafür verwenden musst.</p>
</blockquote>
<p>ICMP basiert auf IP, wobei ARP sich rein auf MAC Addressen bezieht.</p>
<p>Bevor in einem LAN zwei Rechner mit einander kommunizieren müssen<br />
die MAC Addresse bekannt sein, dann wird zunächst ein ARP request<br />
an alle Rechner im LAN Verbund gesendet als Daten wird dann die gewünschte<br />
IP mit übertragen. Da alle Rechner im LAN Verbund denn ARP request empfangen<br />
schaut jeder nach ob seine IP gemeint ist, fühlt sich ein Rechner angesprochen<br />
sendet er ein ARP Reply zurück und somit weiss der Anfragende Rechner welche<br />
MAC Addresse hinter dieser IP steckt.</p>
<p>Hier sieht man einen ARP Request, die Destionation MAC ist FF FF FF FF FF FF<br />
und wird von allen Rechnern im Lan Verbund empfangen.</p>
<pre><code>Ethernet II, Src: 00:15:f2:45:54:8c, Dst: ff:ff:ff:ff:ff:ff
     Destination: ff:ff:ff:ff:ff:ff (Broadcast) // An alle
     Source: 00:15:f2:45:54:8c (00:15:f2:45:54:8c)
     Source or Destination Address: ff:ff:ff:ff:ff:ff (Broadcast)
     Source or Destination Address: 00:15:f2:45:54:8c (00:15:f2:45:54:8c)
     Type: ARP (0x0806)
Address Resolution Protocol (request)
     Hardware type: Ethernet (0x0001)
     Protocol type: IP (0x0800)
     Hardware size: 6
     Protocol size: 4
     Opcode: request (0x0001)
     Sender MAC address: 00:15:f2:45:54:8c (00:15:f2:45:54:8c)
     Sender IP address: 192.168.1.121 (192.168.1.121)
     Target MAC address: 00:00:00:00:00:00 (00:00:00_00:00:00)
     Target IP address: 192.168.1.2 (192.168.1.2)

0000:  FF FF FF FF FF FF 00 15 F2 45 54 8C 08 06 00 01  .........ET.....
0010:  08 00 06 04 00 01 00 15 F2 45 54 8C C0 A8 01 79  .........ET....y
0020:  00 00 00 00 00 00 C0 A8 01 02                    ..........
</code></pre>
<p>Und hier die Antwort des Rechners mit der gewünschten IP.</p>
<pre><code>Ethernet II, Src: 00:11:6b:3b:66:c5, Dst: 00:15:f2:45:54:8c
     Destination: 00:15:f2:45:54:8c (00:15:f2:45:54:8c)
     Source: 00:11:6b:3b:66:c5 (DigitalD_3b:66:c5)
     Source or Destination Address: 00:15:f2:45:54:8c (00:15:f2:45:54:8c)
     Source or Destination Address: 00:11:6b:3b:66:c5 (DigitalD_3b:66:c5)
     Type: ARP (0x0806)
Address Resolution Protocol (reply)
     Hardware type: Ethernet (0x0001)
     Protocol type: IP (0x0800)
     Hardware size: 6
     Protocol size: 4
     Opcode: reply (0x0002)
     Sender MAC address: 00:11:6b:3b:66:c5 (DigitalD_3b:66:c5)
     Sender IP address: 192.168.1.2 (192.168.1.2)
     Target MAC address: 00:15:f2:45:54:8c (00:15:f2:45:54:8c)
     Target IP address: 192.168.1.121 (192.168.1.121)

0000:  00 15 F2 45 54 8C 00 11 6B 3B 66 C5 08 06 00 01  ...ET...k;f.....
0010:  08 00 06 04 00 02 00 11 6B 3B 66 C5 C0 A8 01 02  ........k;f.....
0020:  00 15 F2 45 54 8C C0 A8 01 79 00 00 00 0F 00 10  ...ET....y......
0030:  06 00 00 14 A5 D0 76 31 00 00 00 00              ......v1....
</code></pre>
<p>Hier habe ich nun die Möglichkeit an alle etwas zu senden, da ich einen µC<br />
mit einem eigenen IP/UDP Stack laufen habe kann ich dem so etwas mitteilen<br />
in dem ich z.B. den Opcode: auf 0xffff setze, der Code ist nicht gültig<br />
aber mein µC kennt den Code. Das wollte ich dann benutzen um den µC z.B.<br />
wieder auf default IP zurückzusetzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1405240</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1405240</guid><dc:creator><![CDATA[hermes]]></dc:creator><pubDate>Mon, 19 Nov 2007 01:06:36 GMT</pubDate></item><item><title><![CDATA[Reply to Sockets on Sun, 18 Nov 2007 11:45:39 GMT]]></title><description><![CDATA[<p>GeNeTiX schrieb:</p>
<blockquote>
<p>Hallo,</p>
<p>Nein, ARP ist nicht ICMP. Soweit ich weiss, liegt ICMP auf der gleichen Ebene wie IP, eine Ebene unter TCP im ISO/OSI-Referenzmodell. ARP liegt aber eine Ebene unter IP ist fuer die Aufloesung von IP-Adresse zu MAC-Adresse verantwortlich.<br />
Vielleicht hilft das hier weiter:<br />
<a href="http://msdn2.microsoft.com/en-us/library/aa366358.aspx" rel="nofollow">http://msdn2.microsoft.com/en-us/library/aa366358.aspx</a></p>
</blockquote>
<p>Mit der Funktion SendArp kann ich zwar einen ARP Request senden, habe aber keinen Einfluss auf die Sende Daten.</p>
<p>Ich müsste so etwas mit einem RAW_SOCKET des Typs ARP machen, den gibt es aber nicht. Oder doch?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1405241</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1405241</guid><dc:creator><![CDATA[hermes]]></dc:creator><pubDate>Sun, 18 Nov 2007 11:45:39 GMT</pubDate></item><item><title><![CDATA[Reply to Sockets on Sun, 18 Nov 2007 17:30:41 GMT]]></title><description><![CDATA[<p>Oha, ok, sorry, und danke für die Info <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1405460</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1405460</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Sun, 18 Nov 2007 17:30:41 GMT</pubDate></item><item><title><![CDATA[Reply to Sockets on Mon, 14 Apr 2008 08:37:47 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe die Lösung, ich nehme beim RAW_SOCKET den Typ UDP<br />
und setze für die Target Ip xxx.xxx.xxx.255 ein, die Target Mac ist dann ebenfalls<br />
0xffffffffffff also ein Broadcast. Somit kann ich ein UDP Frame an alle Senden<br />
und die Daten im UDP Frame beinhalten weitere Infos.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1409646</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1409646</guid><dc:creator><![CDATA[hermes]]></dc:creator><pubDate>Mon, 14 Apr 2008 08:37:47 GMT</pubDate></item></channel></rss>