Here is a snippet on where I am hanging in the NetLib from the sample -
can someone help with this?
The funny thing is that the FTPPut works fine through the socket and the
FTPGet works fine as long as there is a file there. But if it is missing it
does not timeout and give an error appropriately. That is when it hangs.
***** The command that is processing when it hangs is...
***** RETR myFilename.dat
***** Remember if it is there it is fine - if not - it hangs. It should
error out.
static void FTPGet(UInt16 argc, CharPtr argv[])
Int16 acceptSock = -1;
Int16 dataSock = -1;
UInt16 reply;
struct sockaddr_in address;
Int16 addrLen;
gFTPGetErr = 0;
// Syntax check
if (argc < 2) {
printf("\nSyntax: %s <filename>", argv[0]);
return;
}
// Send the type command to put us into binary mode
StrPrintF(FTPCommand, "TYPE I\r\n");
NetUWriteN(FTPCtlSock, (UInt8 *)FTPCommand, StrLen(FTPCommand));
if (FTPGetReply(FTPCtlSock, &reply)) goto Exit;
if (reply >= 400) goto Exit;
// Create a data port to get the results
acceptSock = FTPDataAcceptSocket();
if (acceptSock < 0) return;
printf("\nSocket opened");
// Send the RETR command
StrPrintF(FTPCommand, "RETR %s\r\n", argv[1]);
printf("\nDEBUG: Send GET command is: %s", FTPCommand);
printf("\nDEBUG: FTPCommand is %d bytes long", StrLen(FTPCommand));
NetUWriteN(FTPCtlSock, (UInt8 *)FTPCommand, StrLen(FTPCommand));
printf("\nDEBUG: FTPGetReply");
// Get Reply from the RETR command
if (FTPGetReply(FTPCtlSock, &reply)) goto Exit;
printf("\nDEBUG: FTPGetReply check return code is %d", reply);
if (reply >= 400) goto Exit;
printf("\nDEBUG: After FTPGetReply");
// Accept a connection on our data port
addrLen = sizeof(address);
printf("\nDEBUG: addrLen is: %d", addrLen);
/***
**** This is where I am hanging. If I comment out this line and then
obviously
**** the FTPDatabaseRead lines for they are dependant I no longer hang.
****/
if ((dataSock = accept (acceptSock, &address, &addrLen)) < 0) goto
Exit;
/***/
// Read the file
printf("\nRead the database");
errno = FTPDatabaseRead(0, argv[2], dataSock);
// Get Transer complete message
FTPGetReply(FTPCtlSock, &reply);
Exit:
if (errno)
{
gFTPGetErr = 1;
gFTPErr = 1;
printf("\nError: %s", appErrString(errno));
}
if (acceptSock >= 0) close(acceptSock);
if (dataSock >= 0) close(dataSock);
printf("\nSocket and data port closed");
//printf("\nDatabase %s recieved", argv[1]);
}
Thanks,
Daniel A. Schultz
Symmetry Software, Inc.
517.414.3920
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/