Students
asked on
File Sending Problem
I using Pocket PC 2002(Client) Destop Windows 2000 (Server). I am trying to send a file(sound file) from the server to the client through WIRELESS. Aftering sending, my file on the Pocket PC cannot be used. But..
When i try it on a Desktop to Desktop(also wireless), the file can be use.
I also tried sending a workable file from the Pocket PC 2002 to Desktop. It is also workable. So no problem with my codes i think.
I'm using CSocket and C++ for my coding.
Any Help or Advice is appreciated.
THnaks
When i try it on a Desktop to Desktop(also wireless), the file can be use.
I also tried sending a workable file from the Pocket PC 2002 to Desktop. It is also workable. So no problem with my codes i think.
I'm using CSocket and C++ for my coding.
Any Help or Advice is appreciated.
THnaks
ASKER
Sorry for the trouble.. I have solve this problem thanx
You are not checking for a potential error in the Recieve call. It can return SOCKET_ERROR, which I believe equates to -1
That loops looks a little funny. I'd just use:
byte* p= receivedData;
int nBytesLeft= dataLength;
while( nBytesLeft > 0 ) {
int nActual= sockClient.Receive(p,nByte sLeft);
if (nActual == SOCKET_ERROR || nActual == 0) {
// handke the error
}
nBytesLeft -= nActual;
};
(note: I did not verify the above code).
If that is not the problem, then show the code that is sending the data.
-- Dan
That loops looks a little funny. I'd just use:
byte* p= receivedData;
int nBytesLeft= dataLength;
while( nBytesLeft > 0 ) {
int nActual= sockClient.Receive(p,nByte
if (nActual == SOCKET_ERROR || nActual == 0) {
// handke the error
}
nBytesLeft -= nActual;
};
(note: I did not verify the above code).
If that is not the problem, then show the code that is sending the data.
-- Dan
u can ask for refund of points on community support
What was the problem?
-- Dan
-- Dan
Dear expert(s),
A request has been made to close this Q in CS:
https://www.experts-exchange.com/questions/20546050/Refuned.html
Without a response in 72 hrs, a moderator will finalize this question by:
- Saving this Q as a PAQ and refunding the points to the questionner
When you agree or disagree, please add a comment here.
Thank you.
modulo
Community Support Moderator
Experts Exchange
A request has been made to close this Q in CS:
https://www.experts-exchange.com/questions/20546050/Refuned.html
Without a response in 72 hrs, a moderator will finalize this question by:
- Saving this Q as a PAQ and refunding the points to the questionner
When you agree or disagree, please add a comment here.
Thank you.
modulo
Community Support Moderator
Experts Exchange
There would be much more value in the PAQ if Students would take a few moments to describe what he did to solve the problem. Lacking that, I'd recommend a simple delete.
Students, can you describe what you did to solve this problem? Thanks!
-- Dan
Students, can you describe what you did to solve this problem? Thanks!
-- Dan
ASKER
When i send a txt file over .. the first text was missing, so i thought that i started reading at the wrong time.
sockClient.Receive(receive dData, dataLength);
when i replaced the above statemtent with
sockClient.Receive(receive dData+data length+1, dataLength);
the space will moved to the length of the file + 1
sockClient.Receive(receive
when i replaced the above statemtent with
sockClient.Receive(receive
the space will moved to the length of the file + 1
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I tested out by sending a txt file to the PDA and retrieve it again through active sync. the first letter of the txt file is missing.
Can someone check my algorith.
int nBytesRead = sockClient.Receive(&dataLe
byte* receivedData = new byte[dataLength];
nBytesRead = 0;
long dataLengthTemp = dataLength;
MessageBox(_T("Checking data integrity!!!"));
while (dataLength != nBytesRead) {
int dataReadLen = sockClient.Receive(receive
nBytesRead += dataReadLen;
};
sockClient.Receive(receive
CFile destFile(readFile, CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
destFile.Write(receivedDat