[Implemented] networking commands
[Implemented] networking commands
more commands to do netoworking stuff
like:
ConnectFTP (Servername,username,password,port)
DownloadFTP(Servername,path+filename,port)
UploadFTP(Servername,path+filename,port)
DeleteFTP(Servername,path+filename,port)
MkdirFTP(Servername,path+filename,port)
TotalFiles=TotalFilesFTP(Servername,path)
for x=1 to TotalFiles
file$(x)=DirFTP(Servername,path,port)
next x
and can do the same for www or http servers
to get all the files and directorys on an FTP server at certin start point
these would be very handy and wouldn't need the windows API, and make it more portable between linux, amiga, and windows
if anyone could think of anything else network wise please add it in
Sean
like:
ConnectFTP (Servername,username,password,port)
DownloadFTP(Servername,path+filename,port)
UploadFTP(Servername,path+filename,port)
DeleteFTP(Servername,path+filename,port)
MkdirFTP(Servername,path+filename,port)
TotalFiles=TotalFilesFTP(Servername,path)
for x=1 to TotalFiles
file$(x)=DirFTP(Servername,path,port)
next x
and can do the same for www or http servers
to get all the files and directorys on an FTP server at certin start point
these would be very handy and wouldn't need the windows API, and make it more portable between linux, amiga, and windows
if anyone could think of anything else network wise please add it in
Sean
Perhaps in a userlib, but I wouldn't vote for this in the core PB language.
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
i agree with karbon
i could imagine some 'socket' commands though, that might make sense, but a complete protocoll might be over the edge... it's fred's call though
i could imagine some 'socket' commands though, that might make sense, but a complete protocoll might be over the edge... it's fred's call though

( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
Several FTP clients are up over at the resources site now : http://www.reelmediaproductions.com/pb/
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
You can do it without API.
There is a example of an FTP server in PB that doesn't use WinAPI. I think if a server can be built without using API, a client can be built without it as well.
There is a example of an FTP server in PB that doesn't use WinAPI. I think if a server can be built without using API, a client can be built without it as well.
P4 2.4GHz, 256 MB, WinXP Pro, onboard video&audio.
The Programmer's Drinking Song:
"99 little bugs in the code,
99 little bugs.
Fix one bug, recompile
100 little bugs in the code."
The Programmer's Drinking Song:
"99 little bugs in the code,
99 little bugs.
Fix one bug, recompile
100 little bugs in the code."
show me an example of how to connect to an ftp server and send username and password without the use of windows API i have tried and can't figure it out. when i connect using the network commands built into pb i have know idear if it works cause an ftp server doesn't send me any onfo back if it failed or not if you can send me a snipit of connecting to and ftp and sending a file or getting a file that would be great but do it without the ftp commands in the windows API
Ok, in it's simplest form... this code will connect to an FTP server and login with user name and password. No API 
Of course to do things properly, you can't be lazy... you must read up on the FTP protocol, add error checking, proper event checking, etc.
This is only a very simple example to do what you asked.

Code: Select all
#Window_Main=0
#Gadget_Main_Info=1
IP.s="ftp.reelmediaproductions.com"
port.l=21
Procedure send(hNet,msg$)
SendNetworkData(hNet,@msg$,Len(msg$))
EndProcedure
Procedure wait(hNet)
AllocateMemory(0,1000,0)
length=ReceiveNetworkData(hNet,UseMemory(0),1000)
ProcedureReturn UseMemory(0)
EndProcedure
Procedure.l Window_Main()
If OpenWindow(#Window_Main,175,0,351,216,#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_Invisible,"FTP Test")
If CreateGadgetList(WindowID(#Window_Main))
EditorGadget(#Gadget_Main_Info,0,0,350,215)
HideWindow(#Window_Main,0)
ProcedureReturn WindowID()
EndIf
EndIf
EndProcedure
;--------------------
If InitNetwork()
hNet=OpenNetworkConnection(IP,port)
If hNet
Window_Main()
AddGadgetItem(#Gadget_Main_Info,-1,PeekS(wait(hNet)) )
Delay(100)
send(hNet,"USER guest"+Chr(13)+Chr(10))
AddGadgetItem(#Gadget_Main_Info,-1,PeekS(wait(hNet)) )
Delay(100)
send(hNet,"PASS guest"+Chr(13)+Chr(10))
AddGadgetItem(#Gadget_Main_Info,-1,PeekS(wait(hNet)) )
Delay(100)
send(hNet,"QUIT"+Chr(13)+Chr(10))
AddGadgetItem(#Gadget_Main_Info,-1,PeekS(wait(hNet)) )
CloseNetworkConnection(hNet)
Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
Else
MessageRequester("Connection Error","Could Not Connect to FTP Server",#MB_ICONERROR)
EndIf
Else
MessageRequester("Error","Could Not Initialize Network",#MB_ICONERROR)
EndIf
End
This is only a very simple example to do what you asked.
I have wrote a PureBasic DLL for FTP with windows api www.oliv.fr.fm but it is in french, sorry.
explications : http://perso.wanadoo.fr/pav-3dgc-origami/PB/FTP.htm
Download : http://perso.wanadoo.fr/pav-3dgc-origam ... es_FTP.dll
explications : http://perso.wanadoo.fr/pav-3dgc-origami/PB/FTP.htm
Download : http://perso.wanadoo.fr/pav-3dgc-origam ... es_FTP.dll