<?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: C# Chat Application Over Asynchronous UDP Sockets &#8211; Part 2, The Client</title>
	<atom:link href="http://www.daveoncsharp.com/2009/08/csharp-chat-application-over-asynchronous-udp-sockets-part-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.daveoncsharp.com/2009/08/csharp-chat-application-over-asynchronous-udp-sockets-part-2/</link>
	<description>C# Programming Tutorials</description>
	<lastBuildDate>Thu, 26 Jan 2012 22:31:06 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Javid</title>
		<link>http://www.daveoncsharp.com/2009/08/csharp-chat-application-over-asynchronous-udp-sockets-part-2/#comment-18283</link>
		<dc:creator>Javid</dc:creator>
		<pubDate>Tue, 06 Dec 2011 12:43:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.daveoncsharp.com/?p=732#comment-18283</guid>
		<description>Thanks Dave…</description>
		<content:encoded><![CDATA[<p>Thanks Dave…</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Issa</title>
		<link>http://www.daveoncsharp.com/2009/08/csharp-chat-application-over-asynchronous-udp-sockets-part-2/#comment-18238</link>
		<dc:creator>Issa</dc:creator>
		<pubDate>Sat, 21 May 2011 17:06:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.daveoncsharp.com/?p=732#comment-18238</guid>
		<description>I am new in C#  and I have  some diffucults.
I want to send and receive image, but I don&#039;t know how to use the code of image receive ,if you can Dave please write here the class ,where you use image receive method.</description>
		<content:encoded><![CDATA[<p>I am new in C#  and I have  some diffucults.<br />
I want to send and receive image, but I don&#8217;t know how to use the code of image receive ,if you can Dave please write here the class ,where you use image receive method.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://www.daveoncsharp.com/2009/08/csharp-chat-application-over-asynchronous-udp-sockets-part-2/#comment-18229</link>
		<dc:creator>David</dc:creator>
		<pubDate>Mon, 21 Mar 2011 17:36:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.daveoncsharp.com/?p=732#comment-18229</guid>
		<description>Hey, I&#039;m trying to get this to work as a WPF app, got the chat server up and running as a WPF app, now when I try to convert the client to WPF and run it, it connects to the server and the server receives the connection from the client, but I get an error that Receive Data:Vallue cannot be null. Parameter name method.

I don&#039;t understand the error, I mean it&#039;s the same code as on your windows forms application, why is this exception in the ReceiveData method being thrown?

Any clue would be awsome...</description>
		<content:encoded><![CDATA[<p>Hey, I&#8217;m trying to get this to work as a WPF app, got the chat server up and running as a WPF app, now when I try to convert the client to WPF and run it, it connects to the server and the server receives the connection from the client, but I get an error that Receive Data:Vallue cannot be null. Parameter name method.</p>
<p>I don&#8217;t understand the error, I mean it&#8217;s the same code as on your windows forms application, why is this exception in the ReceiveData method being thrown?</p>
<p>Any clue would be awsome&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Khant Thu Linn</title>
		<link>http://www.daveoncsharp.com/2009/08/csharp-chat-application-over-asynchronous-udp-sockets-part-2/#comment-13066</link>
		<dc:creator>Khant Thu Linn</dc:creator>
		<pubDate>Mon, 06 Dec 2010 17:54:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.daveoncsharp.com/?p=732#comment-13066</guid>
		<description>Yo... Thanks you so much ...because of you, I can refer your program and modify into what I need. 
If possible, can I discuss with you for program? via mail?</description>
		<content:encoded><![CDATA[<p>Yo&#8230; Thanks you so much &#8230;because of you, I can refer your program and modify into what I need.<br />
If possible, can I discuss with you for program? via mail?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RealTime - Questions: "Write a program in c++ that takes array by user using for loop and displays it.?"</title>
		<link>http://www.daveoncsharp.com/2009/08/csharp-chat-application-over-asynchronous-udp-sockets-part-2/#comment-12831</link>
		<dc:creator>RealTime - Questions: "Write a program in c++ that takes array by user using for loop and displays it.?"</dc:creator>
		<pubDate>Wed, 01 Dec 2010 18:43:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.daveoncsharp.com/?p=732#comment-12831</guid>
		<description>[...] a switch statement?  Counting Vowels and Prepositions in a text file - Java Programming Forums C# Chat Application Over Asynchronous UDP Sockets &#8211; Part 2, The Client Develop an Age Verification Form Using ActionScript 3 &#124; Blancer.com Tutorials and projects MDU [...]</description>
		<content:encoded><![CDATA[<p>[...] a switch statement?  Counting Vowels and Prepositions in a text file &#8211; Java Programming Forums C# Chat Application Over Asynchronous UDP Sockets &#8211; Part 2, The Client Develop an Age Verification Form Using ActionScript 3 | Blancer.com Tutorials and projects MDU [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jayden</title>
		<link>http://www.daveoncsharp.com/2009/08/csharp-chat-application-over-asynchronous-udp-sockets-part-2/#comment-7926</link>
		<dc:creator>Jayden</dc:creator>
		<pubDate>Tue, 28 Sep 2010 12:04:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.daveoncsharp.com/?p=732#comment-7926</guid>
		<description>Hi Dave, thanks for your reply mate.

I failed at trying to add a new section to the packet, which sends the names to the client :\</description>
		<content:encoded><![CDATA[<p>Hi Dave, thanks for your reply mate.</p>
<p>I failed at trying to add a new section to the packet, which sends the names to the client :\</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://www.daveoncsharp.com/2009/08/csharp-chat-application-over-asynchronous-udp-sockets-part-2/#comment-7925</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Tue, 28 Sep 2010 12:02:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.daveoncsharp.com/?p=732#comment-7925</guid>
		<description>Hi Jayden. Thanks for your comments. 

Why did you fail - what have you tried so far?</description>
		<content:encoded><![CDATA[<p>Hi Jayden. Thanks for your comments. </p>
<p>Why did you fail &#8211; what have you tried so far?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jayden</title>
		<link>http://www.daveoncsharp.com/2009/08/csharp-chat-application-over-asynchronous-udp-sockets-part-2/#comment-7840</link>
		<dc:creator>Jayden</dc:creator>
		<pubDate>Mon, 27 Sep 2010 12:15:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.daveoncsharp.com/?p=732#comment-7840</guid>
		<description>Excellent work mate, exactly what I was looking for. Although, I know nothing about udp packets. 

Would you mind giving me an insight on how to send a list of all the users currently connected to the clients? I tried but failed.</description>
		<content:encoded><![CDATA[<p>Excellent work mate, exactly what I was looking for. Although, I know nothing about udp packets. </p>
<p>Would you mind giving me an insight on how to send a list of all the users currently connected to the clients? I tried but failed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Omar EL Masry</title>
		<link>http://www.daveoncsharp.com/2009/08/csharp-chat-application-over-asynchronous-udp-sockets-part-2/#comment-7304</link>
		<dc:creator>Omar EL Masry</dc:creator>
		<pubDate>Sat, 18 Sep 2010 20:30:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.daveoncsharp.com/?p=732#comment-7304</guid>
		<description>Thanks again Dave ... I will try this method later, but there is something more important I would like to ask about ...

I have noticed that an error occurs on sending a large array of bytes ... I mean a VERY large array ... something that reaches multiple kilobytes ... I dont what exactly limits the buffer size ... 

So, is there a method to send this large array by adjusting the original chat program code instead of the one you sent last time? (I was able to adjust the original code, but I am still limited by the allowed buffer size) ...

Sorry for my continuous questions :)</description>
		<content:encoded><![CDATA[<p>Thanks again Dave &#8230; I will try this method later, but there is something more important I would like to ask about &#8230;</p>
<p>I have noticed that an error occurs on sending a large array of bytes &#8230; I mean a VERY large array &#8230; something that reaches multiple kilobytes &#8230; I dont what exactly limits the buffer size &#8230; </p>
<p>So, is there a method to send this large array by adjusting the original chat program code instead of the one you sent last time? (I was able to adjust the original code, but I am still limited by the allowed buffer size) &#8230;</p>
<p>Sorry for my continuous questions <img src='http://www.daveoncsharp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://www.daveoncsharp.com/2009/08/csharp-chat-application-over-asynchronous-udp-sockets-part-2/#comment-7276</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Fri, 17 Sep 2010 09:37:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.daveoncsharp.com/?p=732#comment-7276</guid>
		<description>You can send whatever you want over sockets - it&#039;s binary data. To send an image, or any other file for that matter, you would do something like this:

To send the file:
&lt;code&gt;// Create stream to load file
FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read);
// Go to beginning of file
fs.Position = 0;
// Setup temporary buffer
byte[] tmpBuf = new byte[1024 * 1024];
while (fs.Position &lt; fs.Length)
{   
	// Loop until we reach the end of file
	int len = fs.Read(tmpBuf, 0, tmpBuf.Length);
	// Write file to stream
	dataStream.Write(tmpBuf, 0, len);
}
// Clean up
fs.Close();&lt;/code&gt;

To receive the file:
&lt;code&gt;fileStream = new FileStream(file, FileMode.Append);
readLenth = 0;
while ((readLenth &lt; dataSize) &amp;&amp; !exitLoop)
{
	// Read data from socket
	bytesReceived = socket.Receive(dataBuffer, 0, dataBuffer.Length, SocketFlags.None);
	// Exit loop if nothing was received
	if (bytesReceived == 0)
	{
		exitLoop = true;
		break;
	}
	readLenth += bytesReceived;
	// Write received data to filestream
	fileStream.Write(dataBuffer, 0, bytesReceived);
}
// Close filestream
socketData.FileStream.Close();&lt;/code&gt;


Hope that helps :-)</description>
		<content:encoded><![CDATA[<p>You can send whatever you want over sockets &#8211; it&#8217;s binary data. To send an image, or any other file for that matter, you would do something like this:</p>
<p>To send the file:<br />
<code>// Create stream to load file<br />
FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read);<br />
// Go to beginning of file<br />
fs.Position = 0;<br />
// Setup temporary buffer<br />
byte[] tmpBuf = new byte[1024 * 1024];<br />
while (fs.Position &lt; fs.Length)<br />
{<br />
	// Loop until we reach the end of file<br />
	int len = fs.Read(tmpBuf, 0, tmpBuf.Length);<br />
	// Write file to stream<br />
	dataStream.Write(tmpBuf, 0, len);<br />
}<br />
// Clean up<br />
fs.Close();</code></p>
<p>To receive the file:<br />
<code>fileStream = new FileStream(file, FileMode.Append);<br />
readLenth = 0;<br />
while ((readLenth &lt; dataSize) &amp;&amp; !exitLoop)<br />
{<br />
	// Read data from socket<br />
	bytesReceived = socket.Receive(dataBuffer, 0, dataBuffer.Length, SocketFlags.None);<br />
	// Exit loop if nothing was received<br />
	if (bytesReceived == 0)<br />
	{<br />
		exitLoop = true;<br />
		break;<br />
	}<br />
	readLenth += bytesReceived;<br />
	// Write received data to filestream<br />
	fileStream.Write(dataBuffer, 0, bytesReceived);<br />
}<br />
// Close filestream<br />
socketData.FileStream.Close();</code></p>
<p>Hope that helps <img src='http://www.daveoncsharp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>

