FTPClient timeout problem

1 message Options
Embed this post
Permalink
Ching de la Serna

FTPClient timeout problem

Reply Threaded More More options
Print post
Permalink
Hi All,

Is there a good way to handle Socket timeouts when transferring files to a server?

ftp _ FTPClient openOnHostNamed: remoteHost.
....some code
ftp putFileNamed: 'something; as: 'something'.  <---error when connecting to remoteHost 

Socket>>connectTo: hostAddress port: port waitForConnectionFor: timeout 
"Initiate a connection to the given port at the given host 
address. Waits until the connection is established or time outs."
self connectNonBlockingTo: hostAddress port: port.
self
waitForConnectionFor: timeout
ifTimedOut: [ConnectionTimedOut signal: 'Cannot connect to '
, (NetNameResolver stringFromAddress: hostAddress) , ':' , port asString]

Thanks in advance,

Ching