<?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[recvfrom WSAEMSGSIZE]]></title><description><![CDATA[<p>Hi!<br />
Habe ein UDP Socket. Wenn eine Nachricht herein kommt, lese ich die mit recvfrom aus.</p>
<p>Problem ist, es sind z. B. 13 Byte gesendet wurden, ich will aber nur immer 1 Byte auslesen(geht nicht anders). Also habe ich einen 1 Byte großen Buffer erstellt, und gebe bei Size halt 1 an.</p>
<p>recvfrom liefert mir jedoch ein SOCKET_ERROR zurück, und WSAGetLastError() sagt mir dann WSAEMSGSIZE.</p>
<blockquote>
<p>A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram was smaller than the datagram itself.</p>
</blockquote>
<p>Also hier ist der Buffer kleiner als der Empfangsbuffer des Socket. Ich verstehe jedoch nicht warum das ein Fehler sein soll oO. Ich will halt nur 1 Byte von den 13 Byte aus dem Empfangsbuffer auslesen.</p>
<p>Wie kann man das umgehen?</p>
<p>mfg olli</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/119297/recvfrom-wsaemsgsize</link><generator>RSS for Node</generator><lastBuildDate>Wed, 08 Jul 2026 15:04:47 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/119297.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 30 Aug 2005 15:39:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to recvfrom WSAEMSGSIZE on Tue, 30 Aug 2005 15:39:36 GMT]]></title><description><![CDATA[<p>Hi!<br />
Habe ein UDP Socket. Wenn eine Nachricht herein kommt, lese ich die mit recvfrom aus.</p>
<p>Problem ist, es sind z. B. 13 Byte gesendet wurden, ich will aber nur immer 1 Byte auslesen(geht nicht anders). Also habe ich einen 1 Byte großen Buffer erstellt, und gebe bei Size halt 1 an.</p>
<p>recvfrom liefert mir jedoch ein SOCKET_ERROR zurück, und WSAGetLastError() sagt mir dann WSAEMSGSIZE.</p>
<blockquote>
<p>A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram was smaller than the datagram itself.</p>
</blockquote>
<p>Also hier ist der Buffer kleiner als der Empfangsbuffer des Socket. Ich verstehe jedoch nicht warum das ein Fehler sein soll oO. Ich will halt nur 1 Byte von den 13 Byte aus dem Empfangsbuffer auslesen.</p>
<p>Wie kann man das umgehen?</p>
<p>mfg olli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/861535</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/861535</guid><dc:creator><![CDATA[Vertex]]></dc:creator><pubDate>Tue, 30 Aug 2005 15:39:36 GMT</pubDate></item><item><title><![CDATA[Reply to recvfrom WSAEMSGSIZE on Tue, 30 Aug 2005 16:02:29 GMT]]></title><description><![CDATA[<p>WSAEMSGSIZE The message was too large to fit into the specified buffer and was truncated.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/861552</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/861552</guid><dc:creator><![CDATA[truncated]]></dc:creator><pubDate>Tue, 30 Aug 2005 16:02:29 GMT</pubDate></item><item><title><![CDATA[Reply to recvfrom WSAEMSGSIZE on Tue, 30 Aug 2005 16:19:46 GMT]]></title><description><![CDATA[<p>Ja, sie wird dann halt beschnitten, aber beim zweiten Aufruf von recvfrom, wo ich eigentlich dann das nächste Byte lesen will, kackt recvfrom ab.<br />
mfg olli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/861559</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/861559</guid><dc:creator><![CDATA[Vertex]]></dc:creator><pubDate>Tue, 30 Aug 2005 16:19:46 GMT</pubDate></item><item><title><![CDATA[Reply to recvfrom WSAEMSGSIZE on Tue, 30 Aug 2005 19:31:13 GMT]]></title><description><![CDATA[<p>Das liegt wahrscheinlich daran, dass alles was du beim erstem Aufruf nicht gelesen hast abgeschnitten und <strong>gelöscht</strong> wird.</p>
<p>MSDN schrieb:</p>
<blockquote>
<p>If the datagram or message is larger than the buffer specified, the buffer is filled with the first part of the datagram, and recvfrom generates the error WSAEMSGSIZE.</p>
</blockquote>
<p>Das kennen wir ja schon, aber...</p>
<p>MSDN schrieb:</p>
<blockquote>
<p>For unreliable protocols (for example, UDP) the excess data is lost.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/861652</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/861652</guid><dc:creator><![CDATA[recvfrom]]></dc:creator><pubDate>Tue, 30 Aug 2005 19:31:13 GMT</pubDate></item><item><title><![CDATA[Reply to recvfrom WSAEMSGSIZE on Sun, 20 Nov 2005 12:33:11 GMT]]></title><description><![CDATA[<p>Ich habe den Thread nochmal ausgekramt, da es nun auch Fehler mit einen 1024 Byte großen Buffer gibt.</p>
<p>Kann man den internen Buffer nicht irgendwie begrenzen?</p>
<p>Ich habe es mit</p>
<pre><code class="language-cpp">int Size = 1024;
setsockopt(Socket, SOL_SOCKET, SO_RCVBUF, &amp;Size, 4)
</code></pre>
<p>probiert, WSAEMSGSIZE ist jedoch weiterhin der Fehlercode. Die Berkleysockets können doch nicht so scheiße designed sein, dass man einen meinetwegen 64K Buffer bereitstellen muss ?oder</p>
<p>mfg olli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/922115</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/922115</guid><dc:creator><![CDATA[Vertex]]></dc:creator><pubDate>Sun, 20 Nov 2005 12:33:11 GMT</pubDate></item><item><title><![CDATA[Reply to recvfrom WSAEMSGSIZE on Sun, 20 Nov 2005 12:58:33 GMT]]></title><description><![CDATA[<p>Der Empfangspuffer muss so gross sein wie eine MTU (maximum-transmission unit), normalerweise 1480 bytes (für lokale Netzwerke); 1400 für VPN und 1500 für PPP...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/922152</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/922152</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Sun, 20 Nov 2005 12:58:33 GMT</pubDate></item><item><title><![CDATA[Reply to recvfrom WSAEMSGSIZE on Sun, 20 Nov 2005 13:09:31 GMT]]></title><description><![CDATA[<p>Danke, das Problem ist jedoch, das man anscheinend diese MTU ändern kann<br />
siehe <a href="http://www.winguides.com/registry/display.php/280/" rel="nofollow">http://www.winguides.com/registry/display.php/280/</a></p>
<p>Habe mir mal mit gestockopt(Socket, SOL_SOCKET, SO_MAX_MSG_SIZE, ..., ...) die Größe des ?Receivebuffers? ausgeben lassen, und kam da auf 65507 Byte.</p>
<p>Ich pers. würde es für pure Ressourcenverschwändung halten, wenn ich 64 KB für jeden Socket bereitstellen müsste.</p>
<p>mfg olli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/922173</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/922173</guid><dc:creator><![CDATA[Vertex]]></dc:creator><pubDate>Sun, 20 Nov 2005 13:09:31 GMT</pubDate></item><item><title><![CDATA[Reply to recvfrom WSAEMSGSIZE on Sun, 20 Nov 2005 13:13:15 GMT]]></title><description><![CDATA[<p>Ja, diese MTU kann man ändern...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/922182</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/922182</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Sun, 20 Nov 2005 13:13:15 GMT</pubDate></item><item><title><![CDATA[Reply to recvfrom WSAEMSGSIZE on Tue, 22 Nov 2005 13:02:28 GMT]]></title><description><![CDATA[<blockquote>
<p>Ich pers. würde es für pure Ressourcenverschwändung halten, wenn ich 64 KB für jeden Socket bereitstellen müsste.</p>
</blockquote>
<p>Klar, das soll lieber das OS machen und wenn möglich auch noch<br />
für jedes Paket einen eigenen Buffer allokieren.<br />
Vielleicht solltest Du mal in Richtung Speicherverschwendung und<br />
Fragmentierung denken. Berkley hat da Gott sei Dank etwas weiter<br />
gedacht als Du.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/924275</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/924275</guid><dc:creator><![CDATA[nemeses]]></dc:creator><pubDate>Tue, 22 Nov 2005 13:02:28 GMT</pubDate></item></channel></rss>