N
Niklas Björkman
Hi,
I´ve installed SP2 for CF today and ran into problems with my socket
communication -
a problem that was not there prior to the upgrade.
From my server i send a stream of bytes using UTF-encoding and use
UTF-encoding
on the Pocket PC to unpack the stream like this:
---------------------------------
Server (WinXP):
---------------------------------
Encoding encode = Encoding.UTF8;
Byte[] buffer encode.GetBytes("<Message>Tally ho</Message>");
// Pseudocode
Socket.Send(.... (Message is send using socket)
---------------------------------
Client (PocketPC compact Framework)
---------------------------------
// Pseudocode
Byte[] buffer = Socket.Receive... (You get the picture)
Encoding encode = Encoding.UTF8;
String data = encoding.GetString(buffer, 0, buffer.Length);
Here is the funny part: Prior to the upgrade the "data" variable was my
message
send from the server but now the "data" is the message with three added
characters "\0\0\0" at the end of the string. So when I look at the message
at
the PocketPC it reads "<Message>Tally ho</Message>0\0\0\". Is there
something
new with the socket and/or the encoding that I have missed or is this a bug?
A workaround is, naturally, removing all three characters at the end of the
message,
but if this is a bug that will be fixed I do not like to send the
application out to my
customers with a Quick-And-Dirty fix.
Regards
Niklas
I´ve installed SP2 for CF today and ran into problems with my socket
communication -
a problem that was not there prior to the upgrade.
From my server i send a stream of bytes using UTF-encoding and use
UTF-encoding
on the Pocket PC to unpack the stream like this:
---------------------------------
Server (WinXP):
---------------------------------
Encoding encode = Encoding.UTF8;
Byte[] buffer encode.GetBytes("<Message>Tally ho</Message>");
// Pseudocode
Socket.Send(.... (Message is send using socket)
---------------------------------
Client (PocketPC compact Framework)
---------------------------------
// Pseudocode
Byte[] buffer = Socket.Receive... (You get the picture)
Encoding encode = Encoding.UTF8;
String data = encoding.GetString(buffer, 0, buffer.Length);
Here is the funny part: Prior to the upgrade the "data" variable was my
message
send from the server but now the "data" is the message with three added
characters "\0\0\0" at the end of the string. So when I look at the message
at
the PocketPC it reads "<Message>Tally ho</Message>0\0\0\". Is there
something
new with the socket and/or the encoding that I have missed or is this a bug?
A workaround is, naturally, removing all three characters at the end of the
message,
but if this is a bug that will be fixed I do not like to send the
application out to my
customers with a Quick-And-Dirty fix.
Regards
Niklas