Re: [fpc-pascal] Implementing a simple tcp/ip connection
Il 28/05/2020 18:00, Graeme Geldenhuys ha scritto: Though in general, I would just use Indy. +1 The main reason is that I have a relevant amount of Delphi/Kylix code using Delphi's Sockets unit. That way porting that code to Lazarus becomes trivial. Secondly my applications typically involve point-to-point connections in a production environment. Upstream machine must communicate with downstream machine, end of line machine must send production data to a dedicated server, and so on. I need to transparently handle failures such as a server side being temporary down. All of that in the hands of unskilled operators. Lighter and simpler code, makes it easier both to develop and to debug. Giuliano -- Do not do to others as you would have them do to you.They might have different tastes. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Implementing a simple tcp/ip connection
On Thu, 28 May 2020, Marco van de Voort wrote: Op 2020-05-28 om 17:08 schreef Giuliano Colla: Hi everybody, I needed to implement a simple dedicated TCP/IP connection between a client and a server. Nothing fancy, just sending and receiving short strings. I have used in the past for that purpose the unit Sockets lifting it from Delphi/Kylix. This unit was taking advantage of libc, and this makes it unusable today. Instead of using heavy libraries such as Synapse, intended or other purposes I believe I have found a simpler and cleaner solution by just using the fpc Sockets unit. This unit however doesn't provide all of the required functionalities. Therefore I have implemented a small unit which I named klibc, which provides the extra functions required such as fpinet_addr, fpgethostbyname etc. and which i share which whomever has similar problems. Why not simply use cnetdb for those calls? Though in general, I would just use Indy. Did you read the mail ? I consider Synapse light-weight. But if Synapse is considered a "heavy library", then Indy is simply a black hole in comparison Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Implementing a simple tcp/ip connection
On 28/05/2020 4:49 pm, Marco van de Voort wrote: > Though in general, I would > just use Indy. +1 Regards, Graeme ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Implementing a simple tcp/ip connection
Op 2020-05-28 om 17:08 schreef Giuliano Colla: Hi everybody, I needed to implement a simple dedicated TCP/IP connection between a client and a server. Nothing fancy, just sending and receiving short strings. I have used in the past for that purpose the unit Sockets lifting it from Delphi/Kylix. This unit was taking advantage of libc, and this makes it unusable today. Instead of using heavy libraries such as Synapse, intended or other purposes I believe I have found a simpler and cleaner solution by just using the fpc Sockets unit. This unit however doesn't provide all of the required functionalities. Therefore I have implemented a small unit which I named klibc, which provides the extra functions required such as fpinet_addr, fpgethostbyname etc. and which i share which whomever has similar problems. Why not simply use cnetdb for those calls? Though in general, I would just use Indy. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Implementing a simple tcp/ip connection
Hi everybody, I needed to implement a simple dedicated TCP/IP connection between a client and a server. Nothing fancy, just sending and receiving short strings. I have used in the past for that purpose the unit Sockets lifting it from Delphi/Kylix. This unit was taking advantage of libc, and this makes it unusable today. Instead of using heavy libraries such as Synapse, intended or other purposes I believe I have found a simpler and cleaner solution by just using the fpc Sockets unit. This unit however doesn't provide all of the required functionalities. Therefore I have implemented a small unit which I named klibc, which provides the extra functions required such as fpinet_addr, fpgethostbyname etc. and which i share which whomever has similar problems. As I'm in possess of a valid licence, I also took advantage of the Kylix Sockets unit, which I adjusted and renamed KSockets to avoid name clashing. Being copyrighted code I can't share it publicly, but I can share it privately with whomever is in a similar condition as mine. I have not yet tested all functionalities, but the Delphi/Kylix NetChat example works just fine. I only had to add KSockets and BaseUnix in the uses clause without touching the rest of code. There are a few things which deserve attention, because some deprecated functions are used, such as inet_addr (which should be replaced with intet_ntoa, already supported by klibc) and suspend and resume used in thread handling. Hope that it can be useful. -- Do not do to others as you would have them do to you.They might have different tastes. <> ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal