Lnet SendAfterError lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- Jake012345 · 2020-05-11 13:23 Hello! I wrote a program with Lnet and I use private declared sockets (so not the aSocket). And when one of my sockets errored, nothing happens, but after that, if server send any message to any socket, It's (the server) crashing with SIGSEGV error. What can I do for avoid this problem? ---------------------------------------------------------------------- MarkMLl · 2020-05-11 13:38 Well to start with, you can keep an eye on topics you've started on the same subject. https://forum.lazarus.freepascal.org/index.php/topic,49675.msg361162.h tml#msg361162 MarkMLl ---------------------------------------------------------------------- Jake012345 · 2020-05-11 15:22 That's good, but I can't solve my problem wit it... ---------------------------------------------------------------------- MarkMLl · 2020-05-11 17:50 Have you tried contacting the authors yet? I suspect that I'm about the last person to do any maintenance on it (I very gingerly added a bit of extra functionality to the Telnet client) but I don't think there's anybody who really understands how it works. MarkMLl ---------------------------------------------------------------------- jiaxing2 · 2020-05-11 18:16 Quote from: MarkMLl on May 11, 2020, 07:50:06 pmHave you tried contacting the authors yet? I suspect that I'm about the last person to do any maintenance on it (I very gingerly added a bit of extra functionality to the Telnet client) but I don't think there's anybody who really understands how it works. MarkMLl I don't think this would help. One of my discipline is don't use abandonware. ---------------------------------------------------------------------- MarkMLl · 2020-05-11 19:19 Quote from: jiaxing2 on May 11, 2020, 08:16:31 pmQuote from: MarkMLl on May 11, 2020, 07:50:06 pmHave you tried contacting the authors yet? I suspect that I'm about the last person to do any maintenance on it (I very gingerly added a bit of extra functionality to the Telnet client) but I don't think there's anybody who really understands how it works. I don't think this would help. One of my discipline is don't use abandonware. I agree, but he might possibly have more success getting in contact with them than the other people who've tried over the last few years- including myself. I don't know the history of lnet, or why it's packaged by itself under utils/fppkg. However for very limited use it's handy not having to specify an external package... most of the networking stuff I do is non-standard so I write on top of the Berkeley Sockets API but I'd rather not have to reimplement something like Telnet unless I really had to. In any event, if OP carries on tinkering with it he's going to be the Local Expert :-) MarkMLl ---------------------------------------------------------------------- Almindor · 2020-05-12 15:59 Quote from: Jake012345 on May 11, 2020, 03:23:45 pmHello! I wrote a program with Lnet and I use private declared sockets (so not the aSocket). And when one of my sockets errored, nothing happens, but after that, if server send any message to any socket, It's (the server) crashing with SIGSEGV error. What can I do for avoid this problem? I haven't had time to go over your code properly yet but from what I see you're using the TLComponent classes wrong. Sockets are created as needed on a listening TLTcp. You get the OnAccept event with the socket in it. You're not supposed to "own" the socket object but just keep a reference to it which you get from these events. You also need to handle OnError events properly and consider any socket that gets reported in the OnError event as invalid from that point on. What I suspect is happening with your code is that you set your socket in your socket array (which is fine in itself, you're just keeping a reference) but then you do not handle either OnError or OnDisconnect properly and do not remove this reference from your list. Then when you try to send something you include that "invalid" socket in the list you try to send to causing a SIGSEGV because the underlayng object (the TLSocket value) has been removed by TLTcp since it disconnected or error-ed out.