Recent

Author Topic: Networking with lazarus fpc on macosx  (Read 17026 times)

facom4ever

  • New Member
  • *
  • Posts: 15
Networking with lazarus fpc on macosx
« on: January 29, 2012, 10:45:06 pm »
Hello,

Can you help me please?

I am with lazarus and fpc on Macosx.

I have to allow my application server to send txt files to my client server. They are both on the same network. I guess I have to use ftp protocol for that.

I tried to install synaps, indy and lnet. But has no one use components I have no clue how to do net working taks with them :(. Tried to search but have not found something clear.

Anyone can sugest me what and how to use :) ?

Thanks !!

Falcom

everton

  • Jr. Member
  • **
  • Posts: 89
Re: Networking with lazarus fpc on macosx
« Reply #1 on: January 30, 2012, 12:30:52 am »
I've used Indy tcp core to send text and binary files beetween server-client application.

It's easy to do. Make the connection: Host and Port basicly. Server side: onExecute AContext.Connection.IOHandler.Write or Read. Client side: IdTCPClient.IOHandler.Write or Read.

It's easy but i'm having problems to make the Indy work now that a put the svn version of lazarus, the projects that contains Indy components stoped to compile. The message is: Can't find the unit x of indy. Some problem with the path. The strange is that the package compile and is installed in the ide. Is very like some path to update in the FPC.

everton

  • Jr. Member
  • **
  • Posts: 89
Re: Networking with lazarus fpc on macosx
« Reply #2 on: January 30, 2012, 12:37:16 am »
To transfer text or binary files the tip is to send first the size of the file and on the read procedure specify that.

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Re: Networking with lazarus fpc on macosx
« Reply #3 on: January 30, 2012, 01:11:44 am »

I havent tried Indy recently so not sure if it works for Mac OS or not but pretty sure that you can use ftp synapse for mac. Also lNet doesnt support Mac platform yet. It will be supported version 0.7
For the synapse examples google it as "ararat synapse"
Thanks.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Networking with lazarus fpc on macosx
« Reply #4 on: January 30, 2012, 06:05:38 am »
Though I haven't tried it on OSX, synapse was easy to install (just copy some files) and use, I never tried Indy...

It never hurts to look at the wiki, either... there's an SSH client example though, not an FTP example:
http://wiki.lazarus.freepascal.org/Synapse
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: Networking with lazarus fpc on macosx
« Reply #5 on: January 30, 2012, 09:31:16 pm »
Don't forget that FPC 2.6.0 now includes HTTP client and other useful units. I've transitioned away from Indy on OS X and use fphttpclient, etc.

Note that for iOS, none of the existing HTTP clients work (Indy, Synapse, FP). With iOS, you can use or extend this simple HTTP client:

http://web.me.com/macpgmr/ObjP/Xcode4/ns_url_request.pas
http://web.me.com/macpgmr/ObjP/Xcode4/NSHelpers.pas  (string helper unit)

This also works with OS X if you need something simple. Note requires FPC 2.6.0 or later.

Thanks.

-Phil

goodname

  • Sr. Member
  • ****
  • Posts: 297
Re: Networking with lazarus fpc on macosx
« Reply #6 on: January 31, 2012, 05:00:54 am »
I'm guessing the http, tcp code is part of fcl-web.
http://wiki.freepascal.org/Web_Service_Toolkit#Connection_Parameters

Looks like fcl-web is based on synapse or ics. Since both are implemented are there uses cases to use one or the other?

I have successfully used lNET with a wince client and a windows server. Is it possible to use the tcp server component in fcl-web to support macosx with a lNET client?

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: Networking with lazarus fpc on macosx
« Reply #7 on: January 31, 2012, 05:23:51 am »
You're confusing two different packages.

fcl_web <> WST
fcl_web is not based on Synapse or ICS
WST is not "based" on Synapse or ICS - you can use it with any of 5 different HTTP client libraries, as described here in using it with iOS:

http://web.me.com/macpgmr/ObjP/Xcode4/ObjP_Part11.html

Not sure if I follow your question. Take a look at the example apps included with WST to see what you can do with it.

Thanks.

-Phil

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Networking with lazarus fpc on macosx
« Reply #8 on: January 31, 2012, 07:31:46 am »
I suspect goodname is looking for some examples of how this FPC 2.6 fphttpclient is used... Probably somewhere in the FPC source code itself, but haven't tried to look lately...
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 9210
  • FPC developer.
Re: Networking with lazarus fpc on macosx
« Reply #9 on: January 31, 2012, 11:06:20 am »
I wouldn't move to lnet (or fphttpclient) out of installation problems.  LNet is rather less forgiving then synapse or Indy, and if you can't deal with installing those, lnet is probably not really for you either.

The advantages of LNET lie more in its minimalism and better alignment with *nix server models. 

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: Networking with lazarus fpc on macosx
« Reply #10 on: January 31, 2012, 11:49:10 am »
I use lNet in Mac OS X and I didn't have any problems.
« Last Edit: January 31, 2012, 11:53:49 am by felipemdc »

everton

  • Jr. Member
  • **
  • Posts: 89
Re: Networking with lazarus fpc on macosx
« Reply #11 on: January 31, 2012, 12:17:11 pm »
Indy has a lot of useful functionalities. The hell is that separated folder ../fpc that the compiler easily doesn`t find. I don`t know why!

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 9210
  • FPC developer.
Re: Networking with lazarus fpc on macosx
« Reply #12 on: January 31, 2012, 12:34:30 pm »
Indy has a lot of useful functionalities. The hell is that separated folder ../fpc that the compiler easily doesn`t find. I don`t know why!

The first thing I do if I test with Indy is to delete all duplicate files in the Indy archive. If any. (specially the .inc files). That saves half of the trouble.

Indy only wants to rectify that in the next major version that is afaik constantly postponed.

goodname

  • Sr. Member
  • ****
  • Posts: 297
Re: Networking with lazarus fpc on macosx
« Reply #13 on: January 31, 2012, 06:27:59 pm »
I should clarify. My experience with networking is limited. Research done 8-9 months ago on sending text messages between applications lead to TCP client and server using lNet on WinCE/Windows. This setup has proven itself in a live environment.

Now thinking about porting the TCP server to OSX and I find that it is now possible build a TCP or HTTP server using units bundled with fpc. Suppose I'm asking can the bundled TCP server units work with a lNet client?

Good to hear that lNet works on OSX today even if it is not official yet. Hopefully that could make a port a simple as installing Lazarus on OSX and compiling.

facom4ever

  • New Member
  • *
  • Posts: 15
Re: Networking with lazarus fpc on macosx
« Reply #14 on: February 02, 2012, 02:49:14 pm »
I installed Synapse. It complies at least 8)

I can do ftp commands now, but isn't the an easier sollution to send file :( ?

I need to setup a ftp server......

EDIT: That sucks. It compiltes but I can't even use the function ping. Some function seem to work only on windows environment.

@Everton
how did you do to install on macosx ? for me it doesnt install the package because it doesnt compile...

@felipemdc
i can only install lnetbase, the components seem to be incompatible Macosx :( how did you do ?
« Last Edit: February 02, 2012, 04:06:49 pm by facom4ever »

 

TinyPortal © 2005-2018