[Lazarus] TInetSocket usage - any documentation available?
Mark Morgan Lloyd
markMLl.lazarus at telemetry.co.uk
Wed Sep 23 11:00:53 CEST 2015
Michael Van Canneyt wrote:
> On Wed, 23 Sep 2015, Bo Berglund wrote:
>> I have looked for a native FPC TCP/IP socket to use as a replacement
>> for a serial port component and I discovered the ssockets unit that
>> ships with FPC and contains a TInetSocket class.
>> This seemed useful.
>> The data shifted through the socket will be EXACTLY the same as was
>> earlier transferred by RS232.
>> Any suggestions on where I can find suitable documentation?
> Shortly said: There is none.
> If the various demo programs are not understandable for you, you are out
> of luck :(
> Now, from what you describe, all you need to do is use the read/write
> methods to send and receive data, just as in any stream: the client
> TInetSock is a TStream descendent.
> Thread programming is not so difficult, but I am not convinced that for
> the use case you describe, threads are really needed (despite
> suggestions to the contrary on this list).
I'd suggest that the bottom line there is making the socket code oresent
the same interface as the existing RS232 code.
I've not used it so I'm not happy giving advice, but Google definitely
turns up a few TInetSocket examples, such as
I agree that it's unfortunate that there's not one in the fcl-net
package itself, but (again via Google) there's a minimal example in
fcl-web/src/base/fcgigate.pp which might help. Also via a local grep I
notice references in fcl-base/examples/dsockcli.pp and
utils/debugsvr/dbugintf.pp which might turn out to be useful.
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
More information about the Lazarus