Ftp command LIST

Blitz3D Forums/Blitz3D Beginners Area/Ftp command LIST

Skurcey(Posted 2005) [#1]
How does it work, do i need to set up something before calling it?
here's my code:
Graphics 800,600,16,2
SetBuffer BackBuffer()
stream=OpenTCPStream("ftp.myftp.com",21)
WriteLine stream,"PASV"
Print 


While Not Eof(stream)
	k=GetKey()
	If k>27 And k<127
		command$=command+Chr(k)
	ElseIf k=8 And Len(command)>0
		command=Left$(command,Len(command)-1)
	ElseIf k=13
		WriteLine stream,command
		command=""
	EndIf
	
	Color 0,0,0
	Rect 0,0,800,13
	Color 0,255,0
	Text 0,0,command
	Color 255,255,255
	
	
	
	If ReadAvail(stream)<>0
		l$= ReadLine$(stream)
		Print l
		exheader=header
		header=Left(l,3)
		If header<>exheader
			Select header
				Case 220
					WriteLine stream,"USER myname"
				Case 331
					WriteLine stream,"PASS mypassword"
				Case 230
					WriteLine stream,"TYPE I"
					
				Case 530
				
			End Select
		EndIf
	EndIf
	
	
	
	If KeyHit(1) Then Goto quit
	Flip
Wend
.quit
CloseTCPStream stream



jfk EO-11110(Posted 2005) [#2]
Select header
Case 220
WriteLine stream,"USER myname"
Case 331
WriteLine stream,"PASS mypassword"
Case 230
WriteLine stream,"TYPE I"
Case 530
End Select

are you sure this works? Maybe try a simple If Then in stead, to make sure you know. can't explain, it's just something in my memory that says "Select is tricky, sometimes, for some reason"


Skurcey(Posted 2005) [#3]
I ve found, i must send PASV and connect to the new stream
But Select works good.