FTP Client in BMax?

BlitzMax Forums/BlitzMax Programming/FTP Client in BMax?

Here is the login:

Global socket:TSocket=CreateTCPSocket()
Local host:String="localhost"
Local user:String="regaa"
Local pass:String="pass"

If socket<>Null
	Print "CreateTCPSocket() OK"
Else
	RuntimeError("Could not create a TCPSocket()")
EndIf

If BindSocket(socket,2021)
	Print "BindSocket(socket,2021) OK"
Else
	RuntimeError("BindSocket(socket,2021)")
EndIf

If ConnectSocket(socket,HostIp(host),21)
	Print "ConnecSocket(socket,ip) OK"
Else
	RuntimeError("ConnecSocket(socket,ip,21)")
EndIf

SocketListen(socket)
Print "SicketListen(socket) OK"

Global socketstream:TSocketStream=CreateSocketStream(socket)

Login(user,pass)

Function ReadMsg()
	Local line:String=" "

	While line<>""
		If SocketReadAvail(socket)=0 Then Exit
		line=ReadLine(socketstream)
		Print line
	Wend
End Function

Function Login(user:String,pass:String)
	ReadMsg()
	WriteLine(socketstream,"USER "+user)
	ReadMsg()
	WriteLine(socketstream,"PASS hidden"+pass)
	ReadMsg()
End Function


Just change host, user and pass to your login.