FTP Client in BMax?

BlitzMax Forums/BlitzMax Programming/FTP Client in BMax?

How much trouble would it be to program a ftp client so that I can upload and dowload files via ftp?

Is it even possible in BMax?

Why is all ftp-clients soo slow?

How much trouble would it be to program a ftp client so that I can upload and dowload files via ftp?

It shouldn't be, as long as you are familiar with writing network apps and use TCP (not UDP) so you know you don't lose packets

Is it even possible in BMax?

It can be done in any programming language that can communicate over TCP/IP

Why is all ftp-clients soo slow?

They aren't, you can download many megabytes a second if the network connection between your computer and the server is fast enough.

Thanks. This sounds better than I thought. I know TCP and Networking in BlitzMax. Where/How do I start with ftp? Any links?

Actually when I think about it, all ftp-clients aren't slow. But many are. It seems like they add some extra time when they establish the connection, request files and such. Ever tried Contribute?

Most FTP programs are as fast as your connection.
Unless those that made it are completely incapable of programming :)

There was a site i used to get all the information about different web protocols but i sadly can't find it but this one looks promising:

http://cr.yp.to/ftp.html

And i also found this which doesn't look as good though:

http://www.scit.wlv.ac.uk/~jphb/comms/ftp.html

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.

Nice regaa, I have to build on that. And Matt, thanks for the links, they are great! When we have GUI support..

When I try to log on to my ftp (With regaa's example) it says this:

220-FTP server ready.
220 This is a private system - No anonymous login


What can be the problem?

I think that just means you have to have a username and password to logon.

Of course =)
Now it's just for me to send commands, shoudn't be to hard to figure out. I never thought ftp was this easy..
Why do all these big compaines have such problems with it? That I don't get!?

If you're looking for internet standards, you should probably Google for "RFC".

The protocols for IRC, HTTP, FTP, POP3, IMAP, SMTP etc etc ad infinitum... are all RFC's (request for comments) which are detailed documents of exactly what needs to be transferred between server and client for things to work.