Sample code
Function Socket( url as string ) as object
sock = CreateObject( "roUrlTransfer" ) ' create socket
sock.SetUrl( url )
return sock
End Function
Function Load_Thumb( url as object, path as object, file as object )
sock = Socket( url )
sock.SetPort(m.port) <------------ global message port
if sock.AsyncGetToFile( path )
Set_Socket( sock, Clr_Socket, file ) <------------ to push socket to active queue
MyMsg( 3, "Wait for Me" ) <------------ "Wait for Me" is an invalid msg type so it just waits 3 ms
else
? "AsyncGetToFile failed"
end if
? "Load "+file+" from " url
End Function
Sub Clr_Socket()
idx = m.index
status = m.msg.GetResponseCode()
? "Clear Socket - " m.name " status = " status
m = GetGlobalAA()
m.sockets.Delete( idx ) <----------- delete socket from active queue
End Sub
The roUrlTransfer object remains visible until it's deleted in the Clr_Socket() routine.
I do have SetRequireAllImagesToDraw set to false.
But this shouldn't have any bearing on the transfers to the disk.
url is the network address
path is the full path to the file
file is just the filename
m.port is a global port that I retrieve all messages on.
MyMsg is a function that distributes the messages --- where ever.
Clr_Socket is the subroutine to call when a message of type roUrlTransfer for THIS socket is posted.
file is a name associated with this socket.