Doesn't make sense at all.......send/recv in socket...



Hi,

It makes me crazy.......I can't figure it out why it is happening at
all...so strange..
Here is the how system works...

Development environment.

Client : .NET Compact Framework 2.0/PPC
Server: .NET Framework 2.0

PPC connects to the server to transfer a file.

Client code in PPC
As you can guess, fs is FileStream.

---
byte[] buf = new buffer[8192];
int bytRead = fs.Read(buf, 0, buf.Length);
while (bytRead > 0)
{
_socket.Send(buf, 0, bytRead, SocketFlags.None);
bytRead = fs.Read(buf, 0, buf.Length);
}
_socket.Close();

---

Server code in the desktop
fs is FileStream.

---

int rBytes = 0;
byte[] buf = new byte[8192];
do
{
rBytes = client.Receive(buf, 0, buf.Length, SocketFlags.None);
fs.Write(buf, 0, rBytes);

} while ( rBytes > 0 );

client.Close();

---------------

When I tested these, it works perfectly under Wireless connection.
HOWEVER, the problem arise when testing this with the cradled device.
With the cradled device, the server ONLY receives 99% data. For example, if
I send a file (162KB) from the PPC, the server ONLY receives 161KB.
I tried to fix possible soultions as best as I can...However, I can't figure
out how this works WITH THE CRADLED device.
Once I take off the device from the cradle, then test under wireless
connection, it WORKS perfectly.....
It is so strange......Why the server ONLY receives 99% when the PPC
cradles?????

Any help would be appreciated.

Thanks,

...........................................................TJ
.



Relevant Pages