[fpc-pascal] Test
Test, please ignore . regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Calculating CRC16?
Hi, On 2022-10-25 09:30, Bo Berglund via fpc-pascal wrote: < snip > Anyone able to help with FPC implementation? Take a look here, https://forum.lazarus.freepascal.org/index.php?topic=54791.0 regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPConnect Timeout
Hi, On 2022-06-08 21:07, James Richters via fpc-pascal wrote: I'm not quite following how I could implement that. Here is what I am trying to do: Uses Serial,Sysutils,Sockets,CRT; var Socket_Address: TSockAddr; opt: LongWord; Connect_Result : Integer; TCP_Connect_Socket : Tsocket; begin Modbus.Device[Device_Number].TCP_Socket := fpsocket(PF_INET, SOCK_STREAM, IPPROTO_TCP); if Modbus.Device[Device_Number].TCP_Socket = TSocket(INVALID_SOCKET) then Writeln('Error Creating Socket: ',SocketError); Socket_Address.sin_family := AF_INET; Socket_Address.sin_addr := StrToNetAddr(Modbus.Device[Device_Number].Connection); Socket_Address.sin_port := htons(Modbus.Device[Device_Number].TCP_Port); Connect_Result := fpconnect(Modbus.Device[Device_Number].TCP_Socket, @Socket_Address, sizeof(Socket_Address)); if Connect_Result = SOCKET_ERROR then Writeln('Error Connecting Socket: ',SocketError); // I want to get this error in 2 seconds ... Are you saying to use TInetSocket instead of the Sockets unit? Or do I just figure out how to use set ConnectTimeout and then that's the timeout that will be used, and still use everything else the same? < snip > ( did not test the code ) Assuming that Modbus.Device[xx].TCP_Socket is a TSocket you'll need to change it to TInetSocket, i.e. something like this : Modbus.Device[Device_Number].TCP_Socket := TInetSocket.Create(Modbus.Device[Device_Number].Connection, Modbus.Device[Device_Number].TCP_Port); Modbus.Device[Device_Number].TCP_Socket.ConnectTimeout := 1000; try Modbus.Device[Device_Number].TCP_Socket.Connect; except { handle the seConnectTimeOut, seConnectFailed, seHostNotFound etc errors } end; or try Modbus.Device[Device_Number].TCP_Socket := TInetSocket.Create(Modbus.Device[Device_Number].Connection, Modbus.Device[Device_Number].TCP_Port, 1000); except { handle the seConnectTimeOut, seConnectFailed, seHostNotFound etc errors } end; Modbus.Device[Device_Number].TCP_Socket.Disconnect; Modbus.Device[Device_Number].TCP_Socket.Free; You could check the TInetSocket examples at https://gitlab.com/freepascal.org/fpc/source/-/tree/main/packages/fcl-net/examples ... regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPConnect Timeout
Hi, Στις 8/6/2022 7:27 μ.μ., ο/η James Richters via fpc-pascal έγραψε: Is there any way to specify a shorter timeout for FPConnect? AFAIK, socket connect timeout is implemented in ssockets ( in TSocketStream ) not in sockets unit. You can use the TInetSocket's class from ssockets unit ( this is what fphttpclient uses ) overloaded constructor with the aConnectTimeout parameter or if you want you can use the ConnectTimeout property before connect and you're ready to go ... regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] freepascal.org SSL_ERROR_BAD_CERT_DOMAIN
Hi, On 2022-01-05 12:05, Michael Van Canneyt via fpc-pascal wrote: On Wed, 5 Jan 2022, Dimitrios Chr. Ioannidis via fpc-pascal wrote: < snip > AFAIK, let's encrypt support's wildcard certificates from 2018. I don't know if anything is changed. I have made some changes, hopefully all is fixed... now it works, thank you Michael . FYI, https://www.hardenize.com/report/freepascal.org/1641377302#www_certs . PS: Plz if it is possible resolve the https://gitlab.com/freepascal.org/fpc/source/-/issues/39488 also. regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] freepascal.org SSL_ERROR_BAD_CERT_DOMAIN
Hi, On 2022-01-05 11:09, Dmitry Boyarintsev via fpc-pascal wrote: On Wed, Jan 5, 2022 at 2:49 AM Dimitrios Chr. Ioannidis via fpc-pascal wrote: the certificate issued for www.freepascal.org [1] and not for freepascal.org [2] . It seems that the let's encrypt script was run with -d freepascal.org [2] instead of -d *.freepascal.org [2] . I don't know how it works for Open Source world, but for the commercial world wild-card certificates (*.freepascal.org [2]) are more expensive, than a single name certificate (www.freepascal.org [1]) AFAIK, let's encrypt support's wildcard certificates from 2018. I don't know if anything is changed. See, https://letsencrypt.org/2017/07/06/wildcard-certificates-coming-jan-2018.html . regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] freepascal.org SSL_ERROR_BAD_CERT_DOMAIN
Hi, On 2022-01-05 11:15, Mattias Gaertner via fpc-pascal wrote: On Wed, 5 Jan 2022 09:40:49 +0200 "Dimitrios Chr. Ioannidis via fpc-pascal" wrote: Hi, Στις 5/1/2022 2:00 π.μ., ο/η Rainer Stratmann via fpc-pascal έγραψε: > https://freepascal.org/ the certificate issued for www.freepascal.org and not for freepascal.org . It seems that the let's encrypt script was run with -d freepascal.org instead of -d *.freepascal.org . or -d freepascal.org,www.freepascal.org you're right of cource :) regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] freepascal.org SSL_ERROR_BAD_CERT_DOMAIN
Hi, Στις 5/1/2022 2:00 π.μ., ο/η Rainer Stratmann via fpc-pascal έγραψε: https://freepascal.org/ the certificate issued for www.freepascal.org and not for freepascal.org . It seems that the let's encrypt script was run with -d freepascal.org instead of -d *.freepascal.org . See https://www.hardenize.com/report/freepascal.org/1641368056 . regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Pascal Ardiono (avr) library
Hi, Στις 3/4/2021 8:49 μ.μ., ο/η Joost van der Sluis via fpc-pascal έγραψε: Hi all, During some spare free time I've ported parts of the Arduino AVR library to Free Pascal. So now it is possible to use things like 'DigitalWrite' and 'Delay'. More info here: https://lazarussupport.com/introducing-pasduino-the-pascal-avr-arduino-library/ The library itself is at: https://gitlab.freepascal.org/Joost/pasduino < snip > Nice ! BTW, IMHO, porting Arduino wiring code is not the way to go. Their libraries are written with an ease of use philosophy and they try to optimize them with the use of a lot of linker and preprocessor trickery, which are not easy to port. IMHO, if you want to use library or framework I'll recommend to take a look to Michael Ring's Microcontroller Board Framework MBF ( https://github.com/michael-ring/mbf ). I think that has support for AVR. One question off topic, can anyone register and use the gitlab scm server ( gitlab.freepascal.org ) ? Is it open for Free Pascal / Lazarus projects ? regards, -- Dimitrios chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Best practice porting a Windows service application to Linux?
Hi, Στις 22/4/2020 1:02 π.μ., ο Bo Berglund via fpc-pascal έγραψε: < sip > But what about the general service framework? The existing code uses a class inherited from TService, does this exist on FPC for Windows and Linux? So it can be crosscompiled for both platforms? Attached you'll find a skeleton project that I use for windows / linux services ( incuded an fclel.res file for windows event loggging ). For debugging I use the usual technique. An infinity loop in debug mode : Run Lazarus with administrator rights. Start the service which will hang into the loop. Add a breakpoint inside the loop and attach the service process. Evaluate, modify the boolean variable which used in the loop from true to false, and you're inside the service # {$IFDEF DEBUG_BUILD} {$DEFINE DEBUG_BUILD_SERVICE} {$ENDIF} . TFPSVC = class(TCustomDaemon) private {$IFDEF DEBUG_BUILD_SERVICE} FServiceDebug: boolean; {$ENDIF} . function TFPSVC.Start: boolean; begin {$IFDEF DEBUG_BUILD_SERVICE} FServiceDebug := True; While FServiceDebug do <--- add a breakpoint here Sleep(2000); {$ENDIF} .. # -- Dimitrios Chr. Ioannidis <> ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] test plz ignore
test plz ignore ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] USB Human Interface Devices
Hi, On 2019-07-26 13:39, James Richters wrote: < snip > Anyone have any suggestions for an FPC only console application method or demo I could use to access this USB HID device? < snip > As I suggested in my previous mail You can use the fpc-usb-hid library from Alfred. I don't see any dependency for Lazarus in the usbcontroller.pas which is, AFAIU, the main unit. If you're not in a hurry, I could try to make a simple console demo this weekend. regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] USB Human Interface Devices
Hi, Στις 26/7/2019 1:04 π.μ., ο James Richters έγραψε: Does Freepascal have support for USB Human Interface devices? I am attempting to interface to an WHB04B-4 https://www.amazon.com/gp/product/B07M5ZY1P2 I have an example of how to do it that was written in Python, so I’m trying to figure out how to get it to work with my FPC console application. Figuring out how to interface with the device at all is what is holding me up, I don’t have any experience with direct interfacing to any USB devices. Any suggestions? you could try Alfred's HID library ( works in windows and linux ) . https://github.com/LongDirtyAnimAlf/FPC-USB-HID. regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Forum down ?
Hi, I just tried to connect to https://forum.lazarus.freepascal.org/ and I got : "Sorry, SMF was unable to connect to the database. This may be caused by the server being busy. Please try again later. " Is it under maintenance ? regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] ENC28J60 Ethernet Controller AVR/ARM Driver
Hi, I started to write a driver ( https://github.com/dioannidis/fp_ethernet_enc28j60.git ) for this chip ( ENC28J60 Ethernet Controller ) first for the AVR platform, ( heavily inspired from the UIPEthernet library ( https://github.com/UIPEthernet/UIPEthernet.git )) and I want to ask the community, of course, is there anyone that already done it ? My goal is to made the free pascal users able to use a very low cost solution Arduino Nano / UNO development board with a ENC28J60 module for a little IoT ( and not only ) fun, learning e.t.c. ... I managed to configure the chip and the driver receives packets ( broadcast packets configured to allow only ARP ). Now, because I'm not embedded developer I'm thinking that I would need help / advices to take some decisions so here I am. First and more important, in the new FPC version, will the AVR platform review / resolve the following issues : "AVR - incorrect stack error checking" (https://bugs.freepascal.org/view.php?id=35332) "AVR - Assembler routines for 8, 16 & 32 bit unsigned div (code contribution)" ( https://bugs.freepascal.org/view.php?id=32103 ) "AVR - invalid address used when evaluating a variable in gdb" ( https://bugs.freepascal.org/view.php?id=33914 ) "AVR - Incorrect SPI clock rate bit constant names in some microcontroller units" ( https://bugs.freepascal.org/view.php?id=32339 ) and add support for theavrxmega3 subarch, atmega 3208, 3209, 4808, 4809 ( from Christo Crause's repository https://github.com/ccrause/freepascal.git ) ? Except from Laksen's ethernet stack ( https://github.com/Laksen/fp-ethernet.git ) is there other, more lightweight, ethernet stack library written in Object Pascal ? As I'm not a compiler guy, isthe "volatile" intrinsic supported in AVR platform ( I didn't find it in intrinsics unit ) ? In FPC embedded world/platforms, is the Object approach more SRAM hungry ( my tests are inconclusive ) from the procedure / function approach ? What's more embedded "friendly" ? this : interface type TUART = Object private FBaudRate: DWord; function Divider: Integer; public procedure Init(const ABaudRate: DWord = 57600); procedure SendChar(c: char); function ReadChar: char; procedure SendString(s: ShortString); procedure SendStringLn(s: ShortString = ''); end; or this : interface var FBaudRate: DWord; function Divider: Integer; procedure Init(const ABaudRate: DWord = 57600); procedure SendChar(c: char); function ReadChar: char; procedure SendString(s: ShortString); procedure SendStringLn(s: ShortString = ''); And of course anyone who wants to help is welcome . regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] AVR GetMem/AllocMem
Hi, Στις 26/1/2019 12:40 μ.μ., ο Michael Ring έγραψε: Did you include the HeapMgr unit? This unit enables heap memory allocation for arm+pic cpu's, hopefully it also works for avr. Am 26.01.19 um 10:29 schrieb Dimitrios Chr. Ioannidis via fpc-pascal: Hi, AFAIU dynamic allocation memory does not exist for AVR platform ( tried to use AllocMem, GetMem and the mcu restart it's self. ) . Is there any other way to dynamically allocate memory in AVR ? didn't know that ! ( Also I didn't read anything regarding this in the wiki ) A quick test shows that it's working. Thx a lot. If you've time could you post any other hint / insight you'll think it could be handy and is not in the wiki ? regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] AVR GetMem/AllocMem
Hi, AFAIU dynamic allocation memory does not exist for AVR platform ( tried to use AllocMem, GetMem and the mcu restart it's self. ) . Is there any other way to dynamically allocate memory in AVR ? ( I'm writing a driver for the ENC28J60 and I need to allocate memory on demand for the ethernet packet buffer ). regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Building FPC from sources on Linux Mint 19, make clean errors out
Hi, On 2018-11-05 14:30, Bo Berglund wrote: ~/dev/fpc/3.0.4$ make clean make: -iVSPTPSOTO: Command not found /bin/rm -f build-stamp.* /bin/rm -f base.build-stamp.* What does this mean and what can I do to fix it? Does it need to be fixed? This works for me the last 3 years : make clean FPC=\ppc executable you'll use. PS: AFAIK, you need to use the previous version official compiler to build the sources. Meaning for 3.0.4 sources you'll need 3.0.2 and not 3.0.0. At least this is what I do to avoid to use the override directive. regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fphttclient, no way to specify a connect timeout
Hi, Στις 24/2/2018 2:00 μμ, ο Luca Olivetti έγραψε: < snip > OK. I got it. Point taken. I don't think you did No I really did ;). The only reliable way to enforce a connect timeout is to try to connect in non-blocking mode. Something like this ( sorry again in ssockects.pp ) for windows only, very draft code proof of concept which it works ( windows 10 here ) : Procedure TInetSocket.Connect; Var A : THostAddr; addr: TInetSockAddr; Res : Integer; nb: DWord; fds: WinSock2.TFDSet; opt: LongInt = 1; len: LongInt; tv : timeval; rslt: longint; begin A := StrToHostAddr(FHost); if A.s_bytes[1] = 0 then With THostResolver.Create(Nil) do try If Not NameLookup(FHost) then raise ESocketError.Create(seHostNotFound, [FHost]); A:=HostAddress; finally free; end; addr.sin_family := AF_INET; addr.sin_port := ShortHostToNet(FPort); addr.sin_addr.s_addr := HostToNet(a.s_addr); tv.tv_sec := IOTIMEOUT div 1000; tv.tv_usec := 0; WinSock2.FD_ZERO(fds); WinSock2.FD_SET(Handle, fds); nb := 1; rslt := WinSock2.ioctlsocket(HANDLE, WinSock2.FIONBIO, @nb); writeln(IntToStr(rslt)); {$ifdef unix} Res := ESysEINTR; while (Res = ESysEINTR) do {$endif} Res := fpConnect(Handle, @addr, sizeof(addr)); if WinSock2.select(Handle, nil, @fds, nil, @tv) > 0 then begin len := SizeOf(opt); if WinSock2.FD_ISSET(Handle, FDS) then fpgetsockopt(Handle, SOL_SOCKET, SO_ERROR, @OPT, @LEN); Res := Opt; end; nb := 0; WinSock2.ioctlsocket(HANDLE, WinSock2.FIONBIO, @nb); If Not (Res<0) then if not FHandler.Connect then begin Res:=-1; CloseSocket(Handle); end; If (Res<0) then Raise ESocketError.Create(seConnectFailed, [Format('%s:%d',[FHost, FPort])]); end; regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fphttclient, no way to specify a connect timeout
Hi, On 2018-02-24 03:42, Luca Olivetti wrote: El 23/02/18 a les 22:57, Dimitrios Chr. Ioannidis via fpc-pascal ha escrit: Hi Στις 23/2/2018 11:14 μμ, ο Luca Olivetti έγραψε: The TFPCustomHTTPClient calls TInetSocket.Create constructor which it calls the inherited constructor from TSocketStream. Which, since TFPHttpClient assigns a socket handler in G, it won't call connect. So the timeout set above is really done before the connect call. OK. I got it. Point taken. You don't want to try to see if it works. Instead we exchange unnecessary emails. My bad. Apologies for pushing you. regards, PS: I'm sure Michael at least he'll take a look. -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fphttclient, no way to specify a connect timeout
Hi Στις 23/2/2018 11:14 μμ, ο Luca Olivetti έγραψε: yes, it does (in procedure TFPCustomHTTPClient.ConnectToServer) FSocket:=TInetSocket.Create(AHost,APort,G); try if FIOTimeout<>0 then FSocket.IOTimeout:=FIOTimeout; <- FSocket.Connect; except FreeAndNil(FSocket); Raise; end; please follow the call stack. The TFPCustomHTTPClient calls TInetSocket.Create constructor which it calls the inherited constructor from TSocketStream. So just before the FSocket.Connect, the above code assigns the internal TSocketStream's FIOTimeout field ( as the TInetSocket is a descendant ) the value from the TFPCustomHTTPClient's FIOTimeout field. Now the folowing addition in the procedure TInetSocket.Connect uses the parents (TSocketStream) private procedure SetIOTimeout and FIOTimeout field to setup the socket timeout option. ssockets.pp line 979 addr.sin_family := AF_INET; addr.sin_port := ShortHostToNet(FPort); addr.sin_addr.s_addr := HostToNet(a.s_addr); SetIOTimeout(FIOTimeout); < {$ifdef unix} Res:=ESysEINTR; While (Res=ESysEINTR) do {$endif} Res:=fpConnect(Handle, @addr, sizeof(addr)); It works because the option is set after the socket is created and before the socket connect call. Of course this is a hack/workaround because if you need different timeouts for connect and receive then you need in the onconnect event handler to change the TFPCustomHTTPClient's FIOTimeout field again for the receive timeout . AFAIK I'm sure Michael will solved it in a more elegant way than my 30 min code review Just try it and tell me if it works. regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fphttclient, no way to specify a connect timeout
Hi, Στις 23/2/2018 8:24 μμ, ο Luca Olivetti έγραψε: El 23/02/18 a les 18:51, Dimitrios Chr. Ioannidis via fpc-pascal ha escrit: copy the ssockets.pp from \packages\fcl-net\src dir to your project dir and add the following line SetIOTimeout(FIOTimeout); to Procedure TInetSocket.Connect; like this fphttpclient already does that before calling connect and it doesn't work. emm it doesn't do that ... did you tried it ... ;) regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fphttclient, no way to specify a connect timeout
Hi, Στις 23/2/2018 5:17 μμ, ο Michael Van Canneyt έγραψε: On Fri, 23 Feb 2018, Luca Olivetti wrote: Hello, the TFpHttpClient has an IoTimeout property, which in turn sets the IOTimeout of its FSocket (TInetSocket), however there's no way to set a connection timeout. I see that even overriding the SocketHandler wouldn't change that, since it's connect is only called *after* the fpconnect call succeeds. Also, I see no way to interrupt a pending connect from another thread. < snip > This is on my todo list. Unfortunately, the way sockets work, this means putting the socket in non-blocking mode, call connect, and then use select or some other means to wait till the socket is done with the connect, and then put the socket again in blocking mode. try this : copy the ssockets.pp from \packages\fcl-net\src dir to your project dir and add the following line SetIOTimeout(FIOTimeout); to Procedure TInetSocket.Connect; like this Procedure TInetSocket.Connect; Var A : THostAddr; addr: TInetSockAddr; Res : Integer; begin A := StrToHostAddr(FHost); if A.s_bytes[1] = 0 then With THostResolver.Create(Nil) do try If Not NameLookup(FHost) then raise ESocketError.Create(seHostNotFound, [FHost]); A:=HostAddress; finally free; end; addr.sin_family := AF_INET; addr.sin_port := ShortHostToNet(FPort); addr.sin_addr.s_addr := HostToNet(a.s_addr); SetIOTimeout(FIOTimeout); {$ifdef unix} Res:=ESysEINTR; While (Res=ESysEINTR) do {$endif} Res:=fpConnect(Handle, @addr, sizeof(addr)); If Not (Res<0) then if not FHandler.Connect then begin Res:=-1; CloseSocket(Handle); end; If (Res<0) then Raise ESocketError.Create(seConnectFailed, [Format('%s:%d',[FHost, FPort])]); end; It works for me regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] GDBServer
Hi, Στις 2017-06-01 18:14, Sven Barth via fpc-pascal έγραψε: Am 01.06.2017 16:49 schrieb "Dimitrios Chr. Ioannidis via fpc-pascal" <fpc-pascal@lists.freepascal.org>: > > Hi, > > I'm trying to "convince" gdbserver ( not gdb ) to attach to a windows service, but I'm always get the "Attach to process failed (error 5): Access is denied. " . > > Did anyone succeed to use gdbserver ( not gdb ) to attach a window service ? Are you running gdbserver as Administrator or as the same user as the service? I tried runas /user:administrator the gdbserver with no luck. I changed the window service to logon from local system account to a local user with administrator rights and tried to execute the gdbserver with runas with the same user with no luck also . Doesn't work in win10 or winxp . I even try to run gdbserver in multi remote-extended mode, same behavior . Tried with the alternatives gdb and gdbserver 7.7.1 from lazarus It's frustrating . regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] GDBServer
Hi, I'm trying to "convince" gdbserver ( not gdb ) to attach to a windows service, but I'm always get the "Attach to process failed (error 5): Access is denied. " . Did anyone succeed to use gdbserver ( not gdb ) to attach a window service ? regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Network compression
Hi, I need to transfer data which are relative big ( 1,2 GB )using low memory ( 512MB, 1GB RAM ) machines. I was thinking something like load partial the file I ie.e a 64K memory block ) compress it send that compressed block via network and at the other end receive that block decompressed it and write it to disk, "repeat until done" . I've searched but I didn't find any example on how to compress / decompress in blocks . Any hints ? regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Threading vs Parallelism ?
Hi, On 29/3/2017 11:15 μμ, Michael Van Canneyt wrote: < snip > Showing nicely that parallelism in a single process implies threads. I would not pay too much attention to what these developers are saying. besides hardware parallelism, how software parallelism ( in the sense of true simultaneous execution ) in a single process without using ( OS dependent ) threads can be achieved ? regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Threading vs Parallelism ?
Hi, On 29/3/2017 9:57 μμ, fredvs wrote: Hello. Some developers treat me as dinosaur because I use threads in place of doing parallelism. Huh, ok, but why parallelism is better and how to do it with fpc ? a nice article I've found long ago when I was researching the same topic "Threading/Concurrency vs. Parallelism" is the following : http://tutorials.jenkov.com/java-concurrency/concurrency-vs-parallelism.html and I tried the multithreadprocslaz package in Lazarus : http://wiki.freepascal.org/Parallel_procedures Happy coding Regards, -- Dimitrios Chr. Ioannidis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal