lNet - LTCPComponent1Receive(aSocket: TLSocket) Event lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- jolix · 2010-06-28 15:05 Hi, As i understood by reading about lnet, i thought "Receive" operated by events. Is this so? I look to several examples and don't see nothing special to enable this event, seems me that is enough declare it in the type section. Then in the implementation i can simply put: Code: [Select]procedure LTCPComponent1Receive(aSocket: TLSocket); begin     aSocket.GetMessage(s); end; The same thing happens with LTCPComponent1Accept(aSocket: TLSocket) that i think is triggered when server accepts the connection. What i see is that those events doesn't work for me, so i wrote my own polling Receive, that is not so elegant as the event is. What i'm doing wrong? Any else help me on this? Thanks, Jo ---------------------------------------------------------------------- JohnvdWaeter · 2010-06-28 21:44 Are you using the component from the LCL? Then it uses the LCL-thread to trigger its events. If not (e.g. in a console or service) you should call the CallAction method frequently, e.g. from a timer. hth! John ---------------------------------------------------------------------- jolix · 2010-06-29 00:26 John, I suppose so. I use visual lNet TCPComponent placed on my form. When i use lNet Telnet Component all events works as supposed to. Regards JO ---------------------------------------------------------------------- JohnvdWaeter · 2010-06-29 04:07 Hmm, I use thenm too, no problem. Do you Connect before you send data?  Is the onConnect event fired? No use to send data if no connection is established... ---------------------------------------------------------------------- jolix · 2010-06-29 13:31 Hi John, Before any else i like to thank you by your concern and help. Answering to your questions: Yes, i'm sending data after connection established. No, onConnect is not fired. Not that neither any else like Receive, etc. I understand that is no use to send data before connection established. As mentioned in my last post, i have the same app using telnet component and all events works fine. Maybe i'm wrong about it but i think the event driven mechanism is generic for all lnet components, like telnet, tcp, udp, etc. So, if telnet works, tcp should work too!? Before you ask for, let me say my program is receiving by pooling  methode and the connection is madded by a state machine inside of a timer with 500mS TICK. The reason is working is because my module running as a server answers to the commands i send by my program. They are some properties or something i have to config to get event driven working ? P.S. You know if exists a lnet user manual? Thanks again, Jo ---------------------------------------------------------------------- jolix · 2010-06-29 16:58 Ok, everything is working now as supposed to do. For some unknown reason, the assignment of events in the Object Inspector for the TLTCPComponent, give me lnet.ppu error (source not found)???. I try unnistall / install lnetvisual several times without results. So i have to edit myapp.lfm and assign the events by hand as follows: Code: [Select]object TcpSocket: TLTCPComponent     left = 536     OnReceive = TcpSocketReceive <<<- line added     OnConnect = TcpSocketConnect <<<- line added end Thanks Jo ---------------------------------------------------------------------- JohnvdWaeter · 2010-06-29 20:09 Ok, So obviously no problem with the lNet components. If it says "file not found" then I guess something in your environment is not properly configured OR there is something wrong with your version of Lazarus. Have you tried latest snapshots? John ---------------------------------------------------------------------- jolix · 2010-06-30 01:12 Ho John, About the file not found, the question is i don't know here is the right location expected by Lazarus. Search the Lazarus root, i found this file in two different locations: C:\lazarus\components\lnet-0.6.3\lib\i386-win32 C:\lazarus\components\lnet-0.6.3\lnet\lazaruspackage\lib\i386-win32 With "Last Snapshots" you mean last Lazarus version? If is the case, i tried install 0.28 version several times on XP and doesn't work for me. So, i have 0.28 version right now. Regards, Jo ---------------------------------------------------------------------- theo · 2010-06-30 01:24 Quote from: jolix on June 30, 2010, 03:12:35 amWith "Last Snapshots" you mean last Lazarus version? "Snapshots" mean the nightly builds available here: ftp://ftp.freepascal.org/pub/lazarus/snapshots But I have not idea if this will fix your problem. ---------------------------------------------------------------------- JohnvdWaeter · 2010-06-30 01:26 Yes, from the daily snapshots page on the lazarus site. If the lNet package is installed correctly, and if there is no permissions problem, the files should have been found by the IDE. I use lNet on both Windows and Linux, no problem. John ---------------------------------------------------------------------- jolix · 2010-07-01 00:30 Hi John and Theo. Unless you want comment any else, i think this question is concluded by now. So, let me present here a word of thanks to John and Theo and take this opportunity to explain that i am new to this things of Lazarus. My specialty is embedded systems with microcontrollers, (hardware/firmware) reason way my questions are so obvious to you but so unknown to me. As certainly you guess, the questions i put here are related with a program to interface with those hardware things. Thanks again. Jo ---------------------------------------------------------------------- Jake012345 · 2020-05-07 08:07 Thanks! That's solved my problem too.