UDP error 22: Invalid argument when sending message.
* Lazarus/FPC Version: Lazarus 2.2.4 (rev Unknown) FPC 3.2.2 x86_64-freebsd-gtk2 * Operating System: FreeBSD 13.1 * CPU / Bitness: 64 Bit <!-- (64 or 32 Bit?) --> * Installed using: pkg install lazarus-gtk2 fpc fpc-sources, fpc-units, fpc-docs fpc-utils Components installed: lNET, ## What happens When sending a message over UDP, an error is received: Send error[22]: Invalid argument. ## What did you expect Expected no error. The same code works when using Lazarus 2.2.2. ## Steps to reproduce 1: Open python and create a UPD socket server execute the following ``` import socket scksrv = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) scksrv.bind(('127.0.0.1', 23223)) scksrv.recvfrom(100) ``` 2: Create in lazarus form. Drop the lNet UDPComponent on it. Craete a button, with an OnClick event. Create also an Error event on the UDPComponent. ``` procedure TForm1.Button1Click(Sender: TObject); begin LUDPComponent1.Host := '127.0.0.1'; LUDPComponent1.Port := 23223; if LUDPComponent1.Connect(LUDPComponent1.Host, LUDPComponent1.Port) then LUDPComponent1.SendMessage('Hello', Format('%s:%d', [LUDPComponent1.Host, LUDPComponent1.Port])) else ShowMessage('Connection failed'); end; procedure TForm1.LUDPComponent1Error(const msg: string; aSocket: TLSocket); begin ShowMessage(msg); end; ``` 3: Compile: Note that the following two messages are displayed in the message window: > Error: /usr/local/bin/ld.bfd: warning: /usr/local/lib/fpc/3.2.2/units/x86_64-freebsd/rtl/cprt0.o: missing .note.GNU-stack section implies executable stack > Error: /usr/local/bin/ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker 4: When the form is visible, click the button -> Error message: Send error [22]: Invalid argument. ## Further info An a different VM also FreeBSD 13.1, having the same version of FPC 3.2.2_3 but Lazarus 2.2.2 the same code does work. The difference is in the output during the compile cycle. The messages in 3: are absent (on Lazarus 2.2.2). There is a difference between into /usr/local/lib/fpc/3.2.2/units/x86_64-freebsd/rtl/cprt0.0 on 2.2.2 and 2.2.4 - file size is the same, content is partly different.
issue