I've been trying to write an IRC client app for windows 8. I've hit some problem. I've started from this tutorial for pytho: http://oreilly.com/pub/h/1968
Resulting into the following code (for python 3.3). It manages to connect to a server, get recognized and logged on until I shut the client down.

Then I tried to port it to C# (.NET 4.5) and the result can be seen below. This code however does not give the same result as the Python code.
I think the following could be happening but I'm not sure: the server doesn't recognize the encoding (which I think is strange). To make everything even more strange, I get 1 ping which contains something that looks like a key (some hexadecimal value) to which I off course respond with a pong.
After that first ping I receive nothing, also I'm not listed in the users list.
But other then an encoding problem, I can't think of anything. Can one of you spot an error in my code? Thanks a lot in advance.

If you suspect it's an encoding issue: what happens when you use ASCII instead of UTF-8?
–
Jeff ENov 21 '12 at 22:14

What is DataWriter? What happens when you use BinaryWriter instead? Also, writing data does not mean the data is "sent" (it's often buffered). Make sure you flush the stream to ensure it's sent.
–
DaiNov 21 '12 at 22:32

@Jeff E: using ASCII didn't change anything unfortunately. In the windows8 app runtime, there is no ASCIIEncoding class, so I had to write a function to convert everything to ASCII, I basically did this: foreach(char c in str) {buffer[index] = (byte)(c & 0xff); index++; }buffer[str.length] = 0; Dai, Datawriter:link , if you've read the code you see that I call both .StoreAsync AND .FlushAsync, also, I added await to the last calls to StoreAsync and FlushAsync.
–
DamacustasNov 22 '12 at 0:14

Just checked what the encoding is that is used in pythons .encode() function. On my system it's UTF-8.
–
DamacustasNov 22 '12 at 0:35

Found the problem, the PONG didn't end with "\r\n".
–
DamacustasNov 25 '12 at 15:26