<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Sending and Receiving Packets</title>
	<atom:link href="http://gafferongames.com/networking-for-game-programmers/sending-and-receiving-packets/feed/" rel="self" type="application/rss+xml" />
	<link>http://gafferongames.com</link>
	<description>Glenn Fiedler&#039;s Game Development Articles and Tutorials</description>
	<lastBuildDate>Tue, 31 Jan 2012 03:56:23 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Glenn Fiedler</title>
		<link>http://gafferongames.com/networking-for-game-programmers/sending-and-receiving-packets/#comment-31220</link>
		<dc:creator>Glenn Fiedler</dc:creator>
		<pubDate>Tue, 27 Dec 2011 08:58:35 +0000</pubDate>
		<guid isPermaLink="false">http://gafferongames.wordpress.com/?page_id=127#comment-31220</guid>
		<description>It changes a lot, the second code is incorrect and is equivalent to always returning true.</description>
		<content:encoded><![CDATA[<p>It changes a lot, the second code is incorrect and is equivalent to always returning true.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kusanagi</title>
		<link>http://gafferongames.com/networking-for-game-programmers/sending-and-receiving-packets/#comment-30966</link>
		<dc:creator>Kusanagi</dc:creator>
		<pubDate>Sun, 25 Dec 2011 21:34:59 +0000</pubDate>
		<guid isPermaLink="false">http://gafferongames.wordpress.com/?page_id=127#comment-30966</guid>
		<description>Dont know if this is the correct place, but.
If any one else, has had the same problem.. and do read
all the comments, damn its allot.

I figure they have a chance to find it.

The problem was it would not initialize sockets..
(code downloaded from the svn btw.)

InitializeSockets() in Net.h (obviously..)

I removed all the plattform independent code, windows only now.
for easier read.

    inline bool InitializeSockets()
    {
        WSADATA WsaData;
        return WSAStartup( MAKEWORD(2,2), &amp;WsaData ) == NO_ERROR;
    }

It only worked with the return on a line by it self with wsastartup:
	
    inline bool InitializeSockets()
    {
        WSADATA WsaData;
        WSAStartup( MAKEWORD(2,2), &amp;WsaData ) == !NO_ERROR;
        return WSAStartup;
    }

My question:
Do this change anything major?
Or nothing at all.

I am trying to study and understand the code
Using VS2010 Express.</description>
		<content:encoded><![CDATA[<p>Dont know if this is the correct place, but.<br />
If any one else, has had the same problem.. and do read<br />
all the comments, damn its allot.</p>
<p>I figure they have a chance to find it.</p>
<p>The problem was it would not initialize sockets..<br />
(code downloaded from the svn btw.)</p>
<p>InitializeSockets() in Net.h (obviously..)</p>
<p>I removed all the plattform independent code, windows only now.<br />
for easier read.</p>
<p>    inline bool InitializeSockets()<br />
    {<br />
        WSADATA WsaData;<br />
        return WSAStartup( MAKEWORD(2,2), &amp;WsaData ) == NO_ERROR;<br />
    }</p>
<p>It only worked with the return on a line by it self with wsastartup:</p>
<p>    inline bool InitializeSockets()<br />
    {<br />
        WSADATA WsaData;<br />
        WSAStartup( MAKEWORD(2,2), &amp;WsaData ) == !NO_ERROR;<br />
        return WSAStartup;<br />
    }</p>
<p>My question:<br />
Do this change anything major?<br />
Or nothing at all.</p>
<p>I am trying to study and understand the code<br />
Using VS2010 Express.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Glenn Fiedler</title>
		<link>http://gafferongames.com/networking-for-game-programmers/sending-and-receiving-packets/#comment-23151</link>
		<dc:creator>Glenn Fiedler</dc:creator>
		<pubDate>Fri, 28 Oct 2011 20:07:18 +0000</pubDate>
		<guid isPermaLink="false">http://gafferongames.wordpress.com/?page_id=127#comment-23151</guid>
		<description>more info:
http://stackoverflow.com/questions/3069204/reading-partially-from-sockets</description>
		<content:encoded><![CDATA[<p>more info:<br />
<a href="http://stackoverflow.com/questions/3069204/reading-partially-from-sockets" rel="nofollow">http://stackoverflow.com/questions/3069204/reading-partially-from-sockets</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Glenn Fiedler</title>
		<link>http://gafferongames.com/networking-for-game-programmers/sending-and-receiving-packets/#comment-23148</link>
		<dc:creator>Glenn Fiedler</dc:creator>
		<pubDate>Fri, 28 Oct 2011 20:05:06 +0000</pubDate>
		<guid isPermaLink="false">http://gafferongames.wordpress.com/?page_id=127#comment-23148</guid>
		<description>i did some more research and this page has some useful info:

http://forum.soft32.com/linux/Problem-unix-sockets-SOCK_DGRAM-ignores-MSG_TRUNC-ftopict339024.html</description>
		<content:encoded><![CDATA[<p>i did some more research and this page has some useful info:</p>
<p><a href="http://forum.soft32.com/linux/Problem-unix-sockets-SOCK_DGRAM-ignores-MSG_TRUNC-ftopict339024.html" rel="nofollow">http://forum.soft32.com/linux/Problem-unix-sockets-SOCK_DGRAM-ignores-MSG_TRUNC-ftopict339024.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Glenn Fiedler</title>
		<link>http://gafferongames.com/networking-for-game-programmers/sending-and-receiving-packets/#comment-23147</link>
		<dc:creator>Glenn Fiedler</dc:creator>
		<pubDate>Fri, 28 Oct 2011 19:59:24 +0000</pubDate>
		<guid isPermaLink="false">http://gafferongames.wordpress.com/?page_id=127#comment-23147</guid>
		<description>interesting. i was not aware of this! it seems you would want to check the MSG_TRUNC flag in addition</description>
		<content:encoded><![CDATA[<p>interesting. i was not aware of this! it seems you would want to check the MSG_TRUNC flag in addition</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: minime</title>
		<link>http://gafferongames.com/networking-for-game-programmers/sending-and-receiving-packets/#comment-22923</link>
		<dc:creator>minime</dc:creator>
		<pubDate>Wed, 26 Oct 2011 10:40:33 +0000</pubDate>
		<guid isPermaLink="false">http://gafferongames.wordpress.com/?page_id=127#comment-22923</guid>
		<description>Hi, you write:

Packets in the queue larger than your receive buffer will be silently discarded. So if you have a 256 byte buffer to receive packets like the code above, and somebody sends you a 300 byte packet, the 300 byte packet will be dropped. You will not receive just the first 256 bytes of the 300 byte packet.

but my linux manpage(7 udp) says: 

All receive operations return only one packet.  When the packet is smaller than the passed buffer, only that much data is returned; when it is  bigger,  the  packet  is truncated and the MSG_TRUNC flag is set.  MSG_WAITALL is not supported.

What is correct now? (and what is portable, since maybe I /want/ to always drop messages bigger)</description>
		<content:encoded><![CDATA[<p>Hi, you write:</p>
<p>Packets in the queue larger than your receive buffer will be silently discarded. So if you have a 256 byte buffer to receive packets like the code above, and somebody sends you a 300 byte packet, the 300 byte packet will be dropped. You will not receive just the first 256 bytes of the 300 byte packet.</p>
<p>but my linux manpage(7 udp) says: </p>
<p>All receive operations return only one packet.  When the packet is smaller than the passed buffer, only that much data is returned; when it is  bigger,  the  packet  is truncated and the MSG_TRUNC flag is set.  MSG_WAITALL is not supported.</p>
<p>What is correct now? (and what is portable, since maybe I /want/ to always drop messages bigger)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tin</title>
		<link>http://gafferongames.com/networking-for-game-programmers/sending-and-receiving-packets/#comment-19506</link>
		<dc:creator>Tin</dc:creator>
		<pubDate>Tue, 13 Sep 2011 01:51:20 +0000</pubDate>
		<guid isPermaLink="false">http://gafferongames.wordpress.com/?page_id=127#comment-19506</guid>
		<description>UDP socket, Linux receive data twice

Hi everyone, 

I am using UDP socket to transmit data from a windows program to a program on Linux. The application on Linux receives data and the application on windows sends data. The problem is the function recvfrom(...) return the same data 2 times. So, I wonder if there is any way to set so that the socket will automatically remove data read from the socket queue? (TCP/IP socket does not have this problem). 
Thanks very much, 
Tin,
poste</description>
		<content:encoded><![CDATA[<p>UDP socket, Linux receive data twice</p>
<p>Hi everyone, </p>
<p>I am using UDP socket to transmit data from a windows program to a program on Linux. The application on Linux receives data and the application on windows sends data. The problem is the function recvfrom(&#8230;) return the same data 2 times. So, I wonder if there is any way to set so that the socket will automatically remove data read from the socket queue? (TCP/IP socket does not have this problem).<br />
Thanks very much,<br />
Tin,<br />
poste</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Monco</title>
		<link>http://gafferongames.com/networking-for-game-programmers/sending-and-receiving-packets/#comment-18525</link>
		<dc:creator>Monco</dc:creator>
		<pubDate>Tue, 30 Aug 2011 11:49:47 +0000</pubDate>
		<guid isPermaLink="false">http://gafferongames.wordpress.com/?page_id=127#comment-18525</guid>
		<description>Awesome article! Thanks a lot :D</description>
		<content:encoded><![CDATA[<p>Awesome article! Thanks a lot <img src='http://gafferongames.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Glenn Fiedler</title>
		<link>http://gafferongames.com/networking-for-game-programmers/sending-and-receiving-packets/#comment-14306</link>
		<dc:creator>Glenn Fiedler</dc:creator>
		<pubDate>Mon, 27 Jun 2011 06:12:10 +0000</pubDate>
		<guid isPermaLink="false">http://gafferongames.wordpress.com/?page_id=127#comment-14306</guid>
		<description>Sure you could do it that way, but seems like an awful lot of farting about just to send and receive some packets :)</description>
		<content:encoded><![CDATA[<p>Sure you could do it that way, but seems like an awful lot of farting about just to send and receive some packets <img src='http://gafferongames.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BlueRaja</title>
		<link>http://gafferongames.com/networking-for-game-programmers/sending-and-receiving-packets/#comment-14219</link>
		<dc:creator>BlueRaja</dc:creator>
		<pubDate>Sat, 25 Jun 2011 08:06:45 +0000</pubDate>
		<guid isPermaLink="false">http://gafferongames.wordpress.com/?page_id=127#comment-14219</guid>
		<description>&quot;Thanks, well I see your point, but I don’t agree – primarily because there is enough commonality between each platform, I’d hate to have to make the same edits across multiple files each time I change something&quot;

 - That is what inheritance is for :) Make a separate class for each OS, and put the common code in the base class.  Then the only `#if PLATFORM == PLATFORM_WHATEVER` code you need is when instantiating your object.</description>
		<content:encoded><![CDATA[<p>&#8220;Thanks, well I see your point, but I don’t agree – primarily because there is enough commonality between each platform, I’d hate to have to make the same edits across multiple files each time I change something&#8221;</p>
<p> &#8211; That is what inheritance is for <img src='http://gafferongames.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Make a separate class for each OS, and put the common code in the base class.  Then the only `#if PLATFORM == PLATFORM_WHATEVER` code you need is when instantiating your object.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

