<?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[Traffic Counter]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich suche eine möglichkeit den Traffic der über die Netzwerkkarte geht zu zählen.<br />
(im Bereich von jede sekunde neuer wert). Für VB habe ich sowas denke ich gefunden( <a href="http://www.activevb.de/tipps/vb6tipps/tipp0383.html" rel="nofollow">http://www.activevb.de/tipps/vb6tipps/tipp0383.html</a> ), nur leider hab ich überhaupt keine Ahnung davon und weiß nicht obs überhaupt funktioniert und wie ich das zum laufen bekommen soll...<br />
Mir würde auch der Code in c++ für eine einmalige Abfrage reichen, den Rest wie Timer und Speicherung in DB etc. bekomm ich allein hin. Wenn jemand sowas also schonmal in umgesezt hat in c++.<br />
Alternativ wäre auch ein beliebiges Programm möglich das dies macht, nur sollten die Traffic-Daten dann in einen mySQL Datenbank geschrieben werden, da ich sie parallel auswerten muss.</p>
<p>Hoffe es kann mir jemand helfen.<br />
Danke &amp; Gruß</p>
<p>edit: ich denke das passt wohl eher ins winapi forum, sorry, bitte verschieben! Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/179598/traffic-counter</link><generator>RSS for Node</generator><lastBuildDate>Thu, 09 Jul 2026 13:32:35 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/179598.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 23 Apr 2007 14:52:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Traffic Counter on Mon, 23 Apr 2007 15:01:52 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich suche eine möglichkeit den Traffic der über die Netzwerkkarte geht zu zählen.<br />
(im Bereich von jede sekunde neuer wert). Für VB habe ich sowas denke ich gefunden( <a href="http://www.activevb.de/tipps/vb6tipps/tipp0383.html" rel="nofollow">http://www.activevb.de/tipps/vb6tipps/tipp0383.html</a> ), nur leider hab ich überhaupt keine Ahnung davon und weiß nicht obs überhaupt funktioniert und wie ich das zum laufen bekommen soll...<br />
Mir würde auch der Code in c++ für eine einmalige Abfrage reichen, den Rest wie Timer und Speicherung in DB etc. bekomm ich allein hin. Wenn jemand sowas also schonmal in umgesezt hat in c++.<br />
Alternativ wäre auch ein beliebiges Programm möglich das dies macht, nur sollten die Traffic-Daten dann in einen mySQL Datenbank geschrieben werden, da ich sie parallel auswerten muss.</p>
<p>Hoffe es kann mir jemand helfen.<br />
Danke &amp; Gruß</p>
<p>edit: ich denke das passt wohl eher ins winapi forum, sorry, bitte verschieben! Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1271818</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1271818</guid><dc:creator><![CDATA[fub0815]]></dc:creator><pubDate>Mon, 23 Apr 2007 15:01:52 GMT</pubDate></item><item><title><![CDATA[Reply to Traffic Counter on Mon, 23 Apr 2007 17:54:34 GMT]]></title><description><![CDATA[<p>Da du das offensichtlich unter Window umsetzen willst: wie wärs mit <a href="http://www.winpcap.org/" rel="nofollow">WinPCap</a>?<br />
Das hat sogar ne eingebaute Statistik-Funktion, zu der auch ein <a href="http://www.winpcap.org/docs/docs_40/html/group__wpcap__tut9.html" rel="nofollow">Beispiel im Manual</a> steht (ist allerdings in C).</p>
<p>Und wenn du wirklich ausführliche Statistiken brauchst, kannst du damit sogar jedes Paket selbst auseinander nehmen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> .</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1271934</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1271934</guid><dc:creator><![CDATA[thommy88]]></dc:creator><pubDate>Mon, 23 Apr 2007 17:54:34 GMT</pubDate></item><item><title><![CDATA[Reply to Traffic Counter on Tue, 24 Apr 2007 08:21:05 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile-var-mode-is-viewprofile-and-u-is-403.html" rel="nofollow">HumeSikkins</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-15.html" rel="nofollow">C++</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-4.html" rel="nofollow">WinAPI</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39405.html" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1272204</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1272204</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Tue, 24 Apr 2007 08:21:05 GMT</pubDate></item><item><title><![CDATA[Reply to Traffic Counter on Wed, 25 Apr 2007 10:29:53 GMT]]></title><description><![CDATA[<p>Danke für den Hinweis!habe versucht das Beispiel zu kompilieren, nur leider gehts nicht. Benutze Dev-C++ und habe ein neues c projekt gestartet, die wpcap include in das Dev-C++ include kopiert und die entsprechende lib (libwpcap.a) dem Projekt hinzugefügt. Leider bekomme ich folgenden Fehler:</p>
<p>Compiler: Default compiler<br />
Building Makefile: &quot;C:\Dev-Cpp\counter_test\Makefile.win&quot;<br />
Finding dependencies for file: C:\Dev-Cpp\counter_test\..\WpdPack\Lib\main.c<br />
Führt make... aus<br />
make.exe -f &quot;C:\Dev-Cpp\counter_test\Makefile.win&quot; all<br />
gcc.exe -D__DEBUG__ -c ../WpdPack/Lib/main.c -o ../WpdPack/Lib/main.obj -I&quot;C:/Dev-Cpp/include&quot; -I&quot;C:/Dev-Cpp/include/wcap&quot; -fexpensive-optimizations -O3 -g3</p>
<p>In file included from C:/Dev-Cpp/include/wcap/pcap-stdinc.h:52,<br />
from C:/Dev-Cpp/include/wcap/pcap.h:41,<br />
from ../WpdPack/Lib/main.c:36:<br />
C:/Dev-Cpp/include/wcap/bittypes.h:36: error: redefinition of typedef 'int8_t'<br />
C:/Dev-Cpp/include/stdint.h:27: error: previous declaration of 'int8_t' was here<br />
C:/Dev-Cpp/include/wcap/bittypes.h:52: error: redefinition of typedef 'int16_t'<br />
C:/Dev-Cpp/include/stdint.h:29: error: previous declaration of 'int16_t' was here<br />
C:/Dev-Cpp/include/wcap/bittypes.h:71: error: redefinition of typedef 'int32_t'<br />
C:/Dev-Cpp/include/stdint.h:31: error: previous declaration of 'int32_t' was here</p>
<p>../WpdPack/Lib/main.c: In function <code>main': ../WpdPack/Lib/main.c:59: error:</code>PCAP_OPENFLAG_PROMISCUOUS' undeclared (first use in this function)<br />
../WpdPack/Lib/main.c:59: error: (Each undeclared identifier is reported only once<br />
../WpdPack/Lib/main.c:59: error: for each function it appears in.)<br />
../WpdPack/Lib/main.c:59: warning: assignment makes pointer from integer without a cast</p>
<p>../WpdPack/Lib/main.c:44: warning: return type of 'main' is not `int'</p>
<p>make.exe: *** [../WpdPack/Lib/main.obj] Error 1</p>
<p>Ausführung beendet</p>
<p>Kann mir eventuell wer weiterhelfen?</p>
<p>Danke &amp; Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1273060</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1273060</guid><dc:creator><![CDATA[fub0815]]></dc:creator><pubDate>Wed, 25 Apr 2007 10:29:53 GMT</pubDate></item><item><title><![CDATA[Reply to Traffic Counter on Wed, 25 Apr 2007 12:43:10 GMT]]></title><description><![CDATA[<p>Wie wäre es mit der GetTcpStatistics/GetUdpStatistics Funktion der WinApi, da kannst du doch ermitteln wie viele Segmente gesendet/empfangen wurde und noch vieles mehr. In der Doku ist sogar ein Quelltextfragment vorhanden.</p>
<p>cya,<br />
0xDEADBEEF</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1273172</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1273172</guid><dc:creator><![CDATA[0xDEADBEEF]]></dc:creator><pubDate>Wed, 25 Apr 2007 12:43:10 GMT</pubDate></item><item><title><![CDATA[Reply to Traffic Counter on Wed, 25 Apr 2007 13:11:54 GMT]]></title><description><![CDATA[<p>fub0815 schrieb:</p>
<blockquote>
<p>habe versucht das Beispiel zu kompilieren, nur leider gehts nicht.</p>
</blockquote>
<p>Mir ist gerade aufgefallen, dass der Beispielcode etwas fehlerhaft bzw. veraltet ist:</p>
<p>fub0815 schrieb:</p>
<blockquote>
<p>../WpdPack/Lib/main.c: In function <code>main': ../WpdPack/Lib/main.c:59: error:</code>PCAP_OPENFLAG_PROMISCUOUS' undeclared (first use in this function)<br />
../WpdPack/Lib/main.c:59: error: (Each undeclared identifier is reported only once<br />
../WpdPack/Lib/main.c:59: error: for each function it appears in.)</p>
</blockquote>
<p>Um PCAP_OPENFLAG_PROMISCUOUS verwenden zu können, musst du &lt;remote-ext.h&gt; einbinden.</p>
<p>fub0815 schrieb:</p>
<blockquote>
<p>../WpdPack/Lib/main.c:44: warning: return type of 'main' is not `int'</p>
</blockquote>
<p>Es sollte natürlich &quot;<strong>int</strong> main(int argc, char **argv)&quot; heißen.</p>
<p>fub0815 schrieb:</p>
<blockquote>
<p>C:/Dev-Cpp/include/wcap/bittypes.h:36: error: redefinition of typedef 'int8_t'<br />
C:/Dev-Cpp/include/stdint.h:27: error: previous declaration of 'int8_t' was here</p>
</blockquote>
<p>Diese Fehler kann ich leider nicht nachvollziehen, da ich Visual Studio verwende, und es dort nach den genannten Änderungen problemlos kompiliert.</p>
<p>Versuch im Zweifelsfall auch mal, eins von den direkt mitgelieferten Beispielen (z.B. basic_dump) zu kompilieren. Die sollten eigentlich auf Anhieb funktionieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1273201</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1273201</guid><dc:creator><![CDATA[thommy88]]></dc:creator><pubDate>Wed, 25 Apr 2007 13:11:54 GMT</pubDate></item><item><title><![CDATA[Reply to Traffic Counter on Wed, 25 Apr 2007 13:27:22 GMT]]></title><description><![CDATA[<blockquote>
<p>Um PCAP_OPENFLAG_PROMISCUOUS verwenden zu können, musst du &lt;remote-ext.h&gt; einbinden.</p>
</blockquote>
<p>das bringt leider wieder neu Fehler hervor...<br />
Compiler: Default compiler<br />
Building Makefile: &quot;C:\Dev-Cpp\counter_test\Makefile.win&quot;<br />
Finding dependencies for file: C:\Dev-Cpp\counter_test\..\WpdPack\Lib\main.c<br />
Führt make... aus<br />
make.exe -f &quot;C:\Dev-Cpp\counter_test\Makefile.win&quot; all<br />
gcc.exe -D__DEBUG__ -c ../WpdPack/Lib/main.c -o ../WpdPack/Lib/main.obj -I&quot;C:/Dev-Cpp/include&quot; -I&quot;C:/Dev-Cpp/include/wcap&quot; -fexpensive-optimizations -O3 -g3</p>
<p>In file included from ../WpdPack/Lib/main.c:35:<br />
C:/Dev-Cpp/include/wcap/remote-ext.h:414: error: syntax error before '*' token<br />
C:/Dev-Cpp/include/wcap/remote-ext.h:414: warning: data definition has no type or storage class</p>
<p>C:/Dev-Cpp/include/wcap/remote-ext.h:417: error: syntax error before &quot;pcap_if_t&quot;<br />
C:/Dev-Cpp/include/wcap/remote-ext.h:418: error: syntax error before '*' token<br />
C:/Dev-Cpp/include/wcap/remote-ext.h:428: error: syntax error before &quot;pcap_remoteact_accept&quot;</p>
<p>C:/Dev-Cpp/include/wcap/remote-ext.h:428: warning: data definition has no type or storage class</p>
<p>In file included from C:/Dev-Cpp/include/wcap/pcap-stdinc.h:52,<br />
from C:/Dev-Cpp/include/wcap/pcap.h:41,<br />
from ../WpdPack/Lib/main.c:37:<br />
C:/Dev-Cpp/include/wcap/bittypes.h:36: error: redefinition of typedef 'int8_t'<br />
C:/Dev-Cpp/include/stdint.h:27: error: previous declaration of 'int8_t' was here<br />
C:/Dev-Cpp/include/wcap/bittypes.h:52: error: redefinition of typedef 'int16_t'<br />
C:/Dev-Cpp/include/stdint.h:29: error: previous declaration of 'int16_t' was here<br />
C:/Dev-Cpp/include/wcap/bittypes.h:71: error: redefinition of typedef 'int32_t'<br />
C:/Dev-Cpp/include/stdint.h:31: error: previous declaration of 'int32_t' was here</p>
<p>../WpdPack/Lib/main.c: In function `main':<br />
../WpdPack/Lib/main.c:60: warning: assignment from incompatible pointer type</p>
<p>make.exe: *** [../WpdPack/Lib/main.obj] Error 1</p>
<p>Ausführung beendet</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/12030">@0xDEADBEEF</a><br />
Habe GetTcpStatistics mal getestet und bekomme folgende ausgabe:<br />
dwRtoAlgorithm: 4<br />
dwRtoMin: 300<br />
dwRtoMax: 120000<br />
dwMaxConn: -1<br />
dwActiveOpens: 8482<br />
dwPassiveOpens: 939<br />
dwAttemptFails: 517<br />
dwEstabResets: 543<br />
dwCurrEstab: 24<br />
dwInSegs: 1060304<br />
dwOutSegs: 981843<br />
dwRetransSegs: 806<br />
dwInErrs: 3<br />
dwOutRsts: 886<br />
dwNumConns: 40</p>
<p>Wo sehe ich da den Traffic?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1273225</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1273225</guid><dc:creator><![CDATA[fub0815]]></dc:creator><pubDate>Wed, 25 Apr 2007 13:27:22 GMT</pubDate></item><item><title><![CDATA[Reply to Traffic Counter on Wed, 25 Apr 2007 13:52:49 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/11508">@thommy88</a><br />
jetzt gehts!<br />
Habe vor</p>
<pre><code class="language-cpp">#include &lt;pcap.h&gt;
</code></pre>
<pre><code class="language-cpp">#define HAVE_REMOTE
</code></pre>
<p>gesetzt und jetzt kann ich es kompilieren und ausführen!<br />
Danke!<br />
Nur möchte das prog ja den adapter wissen... keine Ahnung was ich da eingeben soll. und &quot;WinDump -D&quot; funktioniert nicht, liefert</p>
<blockquote>
<p>Unable to open adapter Error opening adapter: Das System kann das angegebene Gerõt nicht finden. (20).</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1273257</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1273257</guid><dc:creator><![CDATA[fub0815]]></dc:creator><pubDate>Wed, 25 Apr 2007 13:52:49 GMT</pubDate></item><item><title><![CDATA[Reply to Traffic Counter on Wed, 25 Apr 2007 14:15:07 GMT]]></title><description><![CDATA[<p>Habe auch das Problem gelöst, in dem ich die Adapter auswahl aus dem Beispiel &quot;basic_dump&quot; eingebaut habe!<br />
kompiliert und geht auch. Nur wird mir null traffic angezeigt obwohl definitiv was passiert ist!<br />
So sieht die Ausgabe in der Konsole aus:</p>
<blockquote>
<p>C:\Dev-Cpp\counter_test&gt;counter_test<br />
1. \Device\NPF_GenericDialupAdapter (Adapter for generic dialup and VPN capture)<br />
2. \Device\NPF_{53C2D91A-EAA7-4595-89AF-757CF33E6AC9} (Intel(R) PRO/100 VE Network Connection (Microsoft's Packet Scheduler) )<br />
3. \Device\NPF_{EB9806A3-E4DC-4E2D-A640-E4DBE5E4FFCC} (Intel(R) PRO/Wireless 3945ABG Network Connection (Microsoft's Packet Scheduler) )<br />
Enter the interface number (1-3):3<br />
TCP traffic summary:<br />
16:11:00 BPS=0 PPS=0<br />
16:11:01 BPS=0 PPS=0<br />
16:11:02 BPS=0 PPS=0<br />
16:11:03 BPS=0 PPS=0<br />
16:11:04 BPS=0 PPS=0<br />
16:11:05 BPS=0 PPS=0<br />
16:11:06 BPS=0 PPS=0<br />
16:11:07 BPS=0 PPS=0<br />
16:11:08 BPS=0 PPS=0<br />
16:11:09 BPS=0 PPS=0<br />
16:11:10 BPS=0 PPS=0<br />
16:11:11 BPS=0 PPS=0<br />
16:11:12 BPS=0 PPS=0<br />
16:11:13 BPS=0 PPS=0<br />
16:11:14 BPS=0 PPS=0<br />
16:11:15 BPS=0 PPS=0<br />
16:11:16 BPS=0 PPS=0<br />
16:11:17 BPS=0 PPS=0<br />
16:11:18 BPS=0 PPS=0<br />
16:11:19 BPS=0 PPS=0<br />
16:11:20 BPS=0 PPS=0</p>
</blockquote>
<p>Vermutungen warum nichts angezeigt wird?<br />
Danke &amp; Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1273283</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1273283</guid><dc:creator><![CDATA[fub0815]]></dc:creator><pubDate>Wed, 25 Apr 2007 14:15:07 GMT</pubDate></item><item><title><![CDATA[Reply to Traffic Counter on Wed, 25 Apr 2007 14:33:34 GMT]]></title><description><![CDATA[<p>fub0815 schrieb:</p>
<blockquote>
<p>Nur wird mir null traffic angezeigt obwohl definitiv was passiert ist!</p>
</blockquote>
<p>hmm... sicher dass du den richtigen adapter genommen hast?<br />
Und wenn ja, ich weiß nicht genau, ob der Promiscuous Mode mit WLAN funktioniert (das du ja offensichtlich hast). Versuchs evtl. auch mal ohne dieses Flag.</p>
<p>Um ganz sicher zu gehen, kannst du's noch mit nem anderen Programm testen, das WinPCap verwendet (z.B. <a href="http://wireshark.org/" rel="nofollow">Wireshark</a>).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1273303</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1273303</guid><dc:creator><![CDATA[thommy88]]></dc:creator><pubDate>Wed, 25 Apr 2007 14:33:34 GMT</pubDate></item><item><title><![CDATA[Reply to Traffic Counter on Wed, 25 Apr 2007 15:02:48 GMT]]></title><description><![CDATA[<p>Es war wie du vermutet hattest. Es lag an dem Promiscuous Mode Flag, ohne das funktionierts! Ich denke da werd ich mir dann was draus Stricken können...</p>
<blockquote>
<p>16:57:56 BPS=575 PPS=0<br />
16:57:57 BPS=1167 PPS=1<br />
16:57:58 BPS=239251 PPS=76<br />
16:57:59 BPS=249200 PPS=67<br />
16:58:00 BPS=256222 PPS=79<br />
16:58:01 BPS=191977 PPS=66<br />
16:58:02 BPS=100573 PPS=44<br />
16:58:03 BPS=0 PPS=0</p>
</blockquote>
<p>Wenn ich mir den Quelltext anschaue sind die BPS schon Byte, richtig?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1273330</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1273330</guid><dc:creator><![CDATA[fub0815]]></dc:creator><pubDate>Wed, 25 Apr 2007 15:02:48 GMT</pubDate></item><item><title><![CDATA[Reply to Traffic Counter on Wed, 25 Apr 2007 15:55:53 GMT]]></title><description><![CDATA[<p>eine frage bezüglich des <a href="http://www.winpcap.org/docs/docs_40/html/group__wpcap__tut9.html" rel="nofollow">Beispiels</a> hätte ich noch, bezieht sich auf folgenden Bereich:</p>
<pre><code class="language-cpp">......
  /* Start the main loop */
    pcap_loop(fp, 0, dispatcher_handler, (PUCHAR)&amp;st_ts);

    pcap_close(fp);
    return;
}

void dispatcher_handler(u_char *state, const struct pcap_pkthdr *header, const u_char *pkt_data)
{
    struct timeval *old_ts = (struct timeval *)state;
    u_int delay;
.....
</code></pre>
<p>Hier</p>
<pre><code>pcap_loop(fp, 0, [b]dispatcher_handler[/b], (PUCHAR)&amp;st_ts);
</code></pre>
<p>wird ja offensichtlich die Funktion dispatcher_handler aufgefufen, nur ohne argumente! wie geht das denn? die funktion ist doch so definiert:</p>
<pre><code>void dispatcher_handler(u_char *, const struct pcap_pkthdr *, const u_char *)
</code></pre>
<p>möchte nämlich diese Geschichte in mein Projekt einbauen, nur meckert der Compiler an der Stelle mit dem Funktionsaufruf.</p>
<blockquote>
<p>argument of type `void (AuslastungFrm::)(u_char*, const pcap_pkthdr*, const u_char*)' does not match `void (<em>)(u_char</em>, const pcap_pkthdr*, const u_char*)'</p>
</blockquote>
<p>Danke &amp; Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1273368</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1273368</guid><dc:creator><![CDATA[fub0815]]></dc:creator><pubDate>Wed, 25 Apr 2007 15:55:53 GMT</pubDate></item><item><title><![CDATA[Reply to Traffic Counter on Thu, 26 Apr 2007 08:42:18 GMT]]></title><description><![CDATA[<p>fub0815 schrieb:</p>
<blockquote>
<p>Es war wie du vermutet hattest. Es lag an dem Promiscuous Mode Flag, ohne das funktionierts!</p>
</blockquote>
<p>Gut zu wissen, ich hab nämlich selbst ein Programm geschrieben, das WinPCap verwendet, nur hab ich leider kein WLAN zum testen.</p>
<p>fub0815 schrieb:</p>
<blockquote>
<p>Wenn ich mir den Quelltext anschaue sind die BPS schon Byte, richtig?</p>
</blockquote>
<p>Steht ziemlich eindeutig im Quelltext:</p>
<pre><code>/* Get the number of [b]Bits per second[/b] */
Bps.QuadPart=(((*(LONGLONG*)(pkt_data + 8)) * 8 * 1000000) / (delay));
</code></pre>
<p>fub0815 schrieb:</p>
<blockquote>
<p>Hier</p>
<pre><code>pcap_loop(fp, 0, [b]dispatcher_handler[/b], (PUCHAR)&amp;st_ts);
</code></pre>
<p>wird ja offensichtlich die Funktion dispatcher_handler aufgefufen, nur ohne argumente! wie geht das denn? die funktion ist doch so definiert:</p>
<pre><code>void dispatcher_handler(u_char *, const struct pcap_pkthdr *, const u_char *)
</code></pre>
</blockquote>
<p>pcap_loop ruft den dispatcher_handler in Intervallen auf. Das Intervall ist im Statistikmodus der read_timeout, der bei pcap_open angegeben ist, also hier 1000ms, ansonsten wird dispatcher_handler für jedes Paket einmal aufgerufen.<br />
Die Argumente von <a href="http://www.winpcap.org/docs/docs_40/html/group__wpcapfunc.html#gc429cf4f27205111259ff7b02a82eeab" rel="nofollow">dispatcher_handler</a> werden durch WinPCap ausgefüllt.</p>
<p>Schau dir ansonsten auch mal das <a href="http://www.winpcap.org/docs/docs_40/html/group__wpcap__tut.html" rel="nofollow">WinPCap Tutorial</a> an, da sind die meisten Funktionen recht gut erklärt.</p>
<p>fub0815 schrieb:</p>
<blockquote>
<p>möchte nämlich diese Geschichte in mein Projekt einbauen, nur meckert der Compiler an der Stelle mit dem Funktionsaufruf.</p>
<blockquote>
<p>argument of type `void (AuslastungFrm::)(u_char*, const pcap_pkthdr*, const u_char*)' does not match `void (<em>)(u_char</em>, const pcap_pkthdr*, const u_char*)'</p>
</blockquote>
</blockquote>
<p>Es sieht so aus als ob dein handler in ner klasse ist.<br />
Wenn ja, dann solltest du den handler static machen, und über den &quot;user&quot;-Parameter bei pcap_loop den Zeiger auf deine Klasse übergeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1273760</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1273760</guid><dc:creator><![CDATA[thommy88]]></dc:creator><pubDate>Thu, 26 Apr 2007 08:42:18 GMT</pubDate></item></channel></rss>