Tranfering Files lazarus / 13-General ---------------------------------------------------------------------- Eduardo · 2006-06-09 18:43 Hi. I don´t know how to work with TCP /IP, not only in Lazarus, but in Delphi to. In trying to make a aplicattion that will take a file from a server in my net, and I thinking to use Synapse. Someone could help me, tolding how to do that? I even don´t know what to do with Synapse files. Thanks. ---------------------------------------------------------------------- Anonymous · 2006-06-09 19:12 Can you be a bit more specific? Is it a webserver you want to download the file from (HTTP)? Or do you have FTP access to the server? What do you mean with "in my net" ? ---------------------------------------------------------------------- CCRDude · 2006-06-09 19:58 Both would be simple; Use the unit httpsend and this function: function HttpGetBinary(const URL: string; const Response: TStream): Boolean; Or unit ftpsend and: function FtpGetFile(const IP, Port, FileName, LocalFile, User, Pass: string): Boolean; Or use the classes defined in those units if you want more control. If "your net" would be SMB, a simple CopyFile should do, but I guess since you mentioned Synapse, it's about one of those protocolls mentioned. ---------------------------------------------------------------------- edusouzamelo · 2006-06-10 01:57 Well. We have a intranet here in the office. That is a windows one. I was thinking if I want to create a aplication that get a file from other computer I would need to do that by tcp/ip or ftp protocol (I really don´t understand about this), that´s because I already heard about sockets on delphi. So. I don´t know if, in this situation, a CopyFile would resolve, but I supposed that it wouldn´t. Even if I could use CopyFile, how would I point to a file in a computer by ip address? Otherwise, if I have to use Synapse where would I have to put all those unitys that I download from their site? ---------------------------------------------------------------------- CCRDude · 2006-06-10 08:33 Well... Before you plan on to decide whether to use HTTP, FTP, UNC (they're all different methods to use TCP/IP) or whatever, you should talk to the system administrator and ask him which services that other computer offers! HTTP and FTP usually need extra server software running (often preinstalled on Linux, but as good as never on Windows), so you won't be able to use them by default. The UNC method means that you can access a file by \\a.b.c.d\sharename\path\file.ext, where a.b.c.d is the IP address of the computer you try to access (Windows machines only). Of course the folder(s) containing the files need to be shared, and you need to have access rights to that share (again, ask the system administrator of the office; they usually don't like having custom shares on workstations) - but that's the same for all methods - you can't just access anything you want, you need a server part and access rights. And you need to know which protocols are available at all on the other computer serving as a server in this case (not just "another computer I don't understand" I'm afraid) IF you use Synapse, do it like with any other component/unit package. My method is to have a development folder, with a units subfolder, where I place subfolders for the packages used. Then, don't forget to include that path in the project environment settings of the project that uses it. ---------------------------------------------------------------------- edusouzamelo · 2006-06-12 17:37 So. Even with all the dificulties I decided to use synapse, and I did as CCRDude told me. I include the path of the units in project enviroment, include the name of the unit "Ftpsend" in "uses" clauses and try to use the function "ftpgetfile"... Then I tried to compilate and came this error: "Unable to read file 'LResources.pp'... That made lazarus uselles to compilate any other aplicattion and I had to reinstalete it. Did someone know about this problem? ---------------------------------------------------------------------- christophe_D · 2006-06-12 18:17 Quote from: "edusouzamelo"So. Even with all the dificulties I decided to use synapse, and I did as CCRDude told me. I include the path of the units in project enviroment, include the name of the unit "Ftpsend" in "uses" clauses and try to use the function "ftpgetfile"... Then I tried to compilate and came this error: "Unable to read file 'LResources.pp'... That made lazarus uselles to compilate any other aplicattion and I had to reinstalete it. Did someone know about this problem? hello, i used synapse too!! be carefule !! there 2 types of archive to download , one work fine, the other there is lot of error when compiling ... i can send you then working file ( under lazarus 0.9.14 and 0.9.16, windows or linux) and finally , if you get a Doubt , copy all file with ".pas" in the directory of your project ---------------------------------------------------------------------- edusouzamelo · 2006-06-14 11:32 Could you send me this working file? My e-mail is esm0883-cadastro@yahoo.com.br Thank you. The file that I´m using cause me some stranges problems. ---------------------------------------------------------------------- Anonymous · 2006-06-15 19:54 A better alternative may be to use the indy library. Its port to lazarus is not 100% complete but it works well on windows. http://indyproject.org ---------------------------------------------------------------------- edusouzamelo · 2006-06-16 00:49 Thank you. I´ll give indy a try ---------------------------------------------------------------------- edusouzamelo · 2006-06-23 13:48 Hi. I´m here just to tell the solution of my problem. As CCRDude said everything was solved with ftpgetfile function, but just with the version of synapse that Cristophe send me. Of course that I had to install a ftp server in the pc to get the file (I really didn´t know about those thigs. As I had told ). That was not too dificult. And Synapse is really sweet. Thanks a lot.