try this
Code:
#Compile Exe #Register None #Dim All #Include "win32api.inc" #Include "wsock32.inc" Global hsock As Long Global MessageF As String Sub DMessage (SendMsg As String) Dim Message As String MessageF = "" If SendMsg <> "" Then Tcp Print hsock, SendMsg Else SendMsg = "Welcome" Do Tcp Line hsock, Message MessageF = MessageF + Message + $CRLF Loop Until Mid$(Message, 4, 1) = " " Or Len(Message) = 3 MsgBox MessageF, , SendMsg End Sub Function PbMain() As Long hsock = FreeFile Tcp Open Port 21 At "ftp.powerbasic.com" As hsock TIMEOUT 5000 If Err Then MsgBox "Unable to connect" Exit Function End If DMessage "" Do Select Case Val(Mid$(MessageF, 1, 3)) Case 220 ' User DMessage "user anonymous" Case 331 ' password DMessage "pass [email protected]" Case 230 ' logged in, now possible to continue MsgBox "Finished": Exit Do Case Else MsgBox "Unexpected reply": Exit Do End Select Loop Tcp Close hsock End Function
If you seriously want to work with FTP, you should search Don Dickinson's PB library (www.basicguru.com) - at least, I saw it some monthes ago, or to use commercial Marshall Software DLL (search by Marshall and you will find http).
------------------
Leave a comment: