Hi,
That�s the first time I write an e-mail to this forum, but I have been reading you
folks for some time.
Well I have a SFA application based on Palm, that runs on IIIxe palms with PalmOs
3.5. This application is already running for about 6 months and we got about 60 Palms
running it. From about a month ago I have been notified of a strange problems.
The problem consists that when the Palm is connecting and transfering data in an
internet connection it simply frezzes, and nothing more happens. Not even the On/Off
button responds. The user cannot do anything, so they reset their Palms, and,
surprising, when the Palm comes up again they have lost all data (like a Hard Reset).
This problem doesn�t happen every connection and I think that the connection is very
bad, but the Palm cannot detect a TimeOut, or some error like that. It appears that,
if it�s a problem, it�s in the time that the Palm sends data to the server, like a pdb.
So I�m asking any king of help. Has someone in this list experienced problems like
that?? Does someone know a correlated bug or problem in PalmOs 3.5??
I�m adding on the e-mail some code of the functions that sends data from the Palm
to the server, and the function that receives data from the server if it is of any
help.
Functions that sends any data to server :
Boolean NetSendDatabase(Char * database) {
LocalID localID;
DmOpenRef db;
UInt32 record, numRecords, size;
localID = DmFindDatabase(CARD, database);
if(!localID) {
NetSendInt16(netInvalidFile);
return false;
}
db = DmOpenDatabase(CARD, localID, dmModeReadOnly);
if(!db) {
NetSendInt16(netInvalidFile);
return false;
}
DmDatabaseSize(CARD, localID, &numRecords, NULL, &size);
// Quantidade de registros.
if(!NetSendInt16(numRecords)) return false;
for(record = 0; record < numRecords; record ++) {
UInt32 recordSize;
MemHandle recHandle = DmQueryRecord(db, record);
MemPtr recPtr = MemHandleLock(recHandle);
MemHandleUnlock(recHandle);
recordSize = MemPtrSize(recPtr);
NetSendInt16(recordSize);
NetSend((Char *) recPtr, recordSize);
}
DmCloseDatabase(db);
return true;
}
Boolean NetSendInt16(long value) {
return NetSend((Char *) &value, sizeof(long));
}
static Boolean NetSend(Char * buffer, long size) {
Err err;
long offset = 0, done;
while(offset < size) {
done = NetLibSend(AppNetRefnum, socket, buffer + offset, size - offset, 0, 0, 0,
AppNetTimeout, &err);
if(done == -1) {
error = netErrSendingData;
return false;
}
offset += done;
}
return true;
}
Function that receives data from the server. Please note that the struture of the code
(the functions that call this one) is like the structure of the code that sends data :
static Boolean NetReceive(Char * buffer, long size) {
Err err;
long offset = 0, done;
while(offset < size) {
done = NetLibReceive(AppNetRefnum, socket, buffer + offset, size - offset, 0, 0,
0, AppNetTimeout, &err);
if(done == -1) {
error = netErrReceivingData;
return false;
}
offset += done;
}
return true;
}
Thanks In Advance
Flexa
Sydeco Tecnologia em Sistemas.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/
Troubles in connections! PalmOs 3.5
Jose dos Campos Flexa R. Filho - Sydeco Campinas Mon, 03 Sep 2001 07:46:17 -0700
