Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CFReadStreamOpen 550 error



I have a very slow FTP server I am trying to download a file from. Logging in in passive mode can take anywhere between 30 seconds to 2 minutes, but login never fails given enough time.

When I open a CFReadStreamRef for downloading a file via CFReadStreamCreateWithFTPURL and then loop checking CFReadStreamGetStatus immediately after opening it, it first returns CFStreamStatusOpening and a few seconds later fails with kCFStreamStatusError, which I believe is because the FTP server doesn't respond immediately.

Is there a way to set the timeout on the stream's opening so that it will wait longer for really slow servers? I've verified everything else is correct: user name, password, path to file, the stream gets created and opens properly.

Here is my code:

// Make URL to file...

ftpURL = CFURLCreateWithString( kCFAllocatorDefault, kmaCurrentVersionsFIleURLCFString, NULL );
if( ftpURL )
{
// Make Read stream...

readStreamCFRef = CFReadStreamCreateWithFTPURL(kCFAllocatorDefault, ftpURL );
if( readStreamCFRef )
{
// Set properties

streamPropertySet = CFReadStreamSetProperty( readStreamCFRef, kCFStreamPropertyFTPUserName, CFSTR( "michael1" ) );


streamPropertySet = CFReadStreamSetProperty( readStreamCFRef, kCFStreamPropertyFTPPassword, CFSTR( "a1a1a1" ) );

streamPropertySet = CFReadStreamSetProperty( readStreamCFRef, kCFStreamPropertyFTPUsePassiveMode, kCFBooleanTrue );

streamPropertySet = CFReadStreamSetProperty( readStreamCFRef, kCFStreamPropertyFTPResourceSize, (CFNumberRef)kmaCurrentVersionsFIleSizeInBytes );

streamPropertySet = CFReadStreamSetProperty( readStreamCFRef, kCFStreamPropertyFTPFetchResourceInfo, kCFBooleanFalse );

streamPropertySet = CFReadStreamSetProperty( readStreamCFRef, kCFStreamPropertyFTPFileTransferOffset, 0 );

streamPropertySet = CFReadStreamSetProperty( readStreamCFRef, kCFStreamPropertyFTPAttemptPersistentConnection, kCFBooleanTrue );

// Open the stream...

streamOpened = CFReadStreamOpen( readStreamCFRef );
if( streamOpened )
{
// Wait for stream open success

while( ( streamStatus != kCFStreamStatusOpen ) && ( streamStatus != kCFStreamStatusError ) )
{
// Wait for open to complete...

streamStatus = CFReadStreamGetStatus( readStreamCFRef );
}


I get kCFStreamStatusError at this point and CFReadStreamGetError returns 6 and 550 for the domain & error which appears to be "SSL/TLS required on the control channel". Is there anything I else I need to set in order to avoid this error?

Thanks,

Mike
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/macnetworkprog/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.