Recent

Author Topic: UDP and MYSQL not working after Reinstall  (Read 3683 times)

Bas

  • New Member
  • *
  • Posts: 16
UDP and MYSQL not working after Reinstall
« on: August 17, 2021, 12:26:52 pm »
My old computer gave up so i bought a new one and reinstalled Lazarus IDE. After recompiling software that worked before it seems iI overlooked something and i cant figure out what. I'm using UDP Packets to transmit and receive data from various sensors on the network and store them in a MYSQL database. All incoming UDP packets are received fine but no UDP packets are transmitted (checked with Wireshark).

OS = Windows 10 and using lnet UDP component for UDP comms
tried latest version of Lazarus but also installed 2.06 and 2.08 with no difference
All firewalls are disabled
Tried disabling IPV6 with same result

All I have tried so far has the same result -> no packets transmitted

Any one have a clue in which direction I should be searching because i ran out of options.

Regards,

Bas 

Bas

  • New Member
  • *
  • Posts: 16
Re: UDP and MYSQL not working after Reinstall
« Reply #1 on: August 18, 2021, 12:51:53 am »
Update :

Reinstalling Windows didn't help either.

Old executable of the same software works fine

I'm Clueless  :'(

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1106
Re: UDP and MYSQL not working after Reinstall
« Reply #2 on: August 18, 2021, 04:58:28 am »
My old computer gave up so i bought a new one and reinstalled Lazarus IDE. After recompiling software that worked before it seems iI overlooked something and i cant figure out what. I'm using UDP Packets to transmit and receive data from various sensors on the network and store them in a MYSQL database. All incoming UDP packets are received fine but no UDP packets are transmitted (checked with Wireshark).

OS = Windows 10 and using lnet UDP component for UDP comms
tried latest version of Lazarus but also installed 2.06 and 2.08 with no difference
All firewalls are disabled
Tried disabling IPV6 with same result

All I have tried so far has the same result -> no packets transmitted

Any one have a clue in which direction I should be searching because i ran out of options.

Regards,

Bas

Update :

Reinstalling Windows didn't help either.

Old executable of the same software works fine

I'm Clueless  :'(
It's difficult to guess without seeing your source code.
My suggestion is that you prepare and attach to this thread a very small example that uses UDP to send and receive data to isolate your problem and store that data to a Memo or a text file instead of MySQL.

Bas

  • New Member
  • *
  • Posts: 16
Re: UDP and MYSQL not working after Reinstall
« Reply #3 on: August 18, 2021, 12:53:41 pm »
Even this simple program doesn't send anything

Code: [Select]
unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls,
  lNetComponents;

type

  { TForm1 }

  TForm1 = class(TForm)
    LUDPComponent1: TLUDPComponent;
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
  private

  public

  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.Timer1Timer(Sender: TObject);
begin
       LUDPComponent1.SendMessage('Test','192.168.1.22:4002');
end;

end.
                                               
« Last Edit: August 18, 2021, 12:57:06 pm by Bas »

Bas

  • New Member
  • *
  • Posts: 16
Re: UDP and MYSQL not working after Reinstall
« Reply #4 on: August 25, 2021, 07:38:03 pm »
Its not Lazarus or Windows related because i made a quick and dirty version with winsock which works fine. So it looks it's something in the lnet component.
Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
  9.   windows,winsock2;
  10.  
  11. type
  12.  
  13.   { TForm1 }
  14.  
  15.   TForm1 = class(TForm)
  16.     Label1: TLabel;
  17.     Timer1: TTimer;
  18.     procedure Timer1Timer(Sender: TObject);
  19.   private
  20.  
  21.   public
  22.  
  23.   end;
  24.  
  25. var
  26.   Form1: TForm1;
  27.  
  28. implementation
  29.  
  30. {$R *.lfm}
  31.  
  32. { TForm1 }
  33.  
  34. procedure TForm1.Timer1Timer(Sender: TObject);
  35.  
  36. var
  37.   MyData:WSADATA;
  38.   Rslt:Integer;
  39.   s:TSocket;
  40.   SendBuf:Array[0..3] of AnsiChar;
  41.   clientservice:sockaddr_in;
  42.   BytesSent:Integer;
  43.  
  44. begin
  45.  try
  46.    Rslt := WSAStartup(MAKEWORD (2,2), MyData);
  47.    if Rslt = NO_ERROR then
  48.    begin
  49.     s := socket(AF_INET, SOCK_DGRAM,0);
  50.     if s <> INVALID_SOCKET then
  51.     begin
  52.       clientservice.sin_family := AF_INET;
  53.       clientservice.sin_addr.s_addr := inet_addr('192.168.1.22');
  54.       clientservice.sin_port := htons(6125);
  55.       if connect(s,clientservice,sizeof(clientservice)) <> SOCKET_ERROR then
  56.        begin
  57.         sendbuf := 'Test';
  58.         bytesSent := send(s,sendbuf,Length(sendbuf),0);
  59.       end else label1.Caption:='Failed to connect';
  60.     end else label1.caption:='Error at Socket: ';
  61.    end else label1.caption:='Error at WSAStartup';
  62.  finally
  63.   WSACleanUp;
  64.   end;
  65.  end;
  66. end.
  67.  
  68.  
« Last Edit: August 25, 2021, 07:50:03 pm by Bas »

Bas

  • New Member
  • *
  • Posts: 16
Re: UDP and MYSQL not working after Reinstall
« Reply #5 on: August 27, 2021, 05:35:29 pm »
tested about everything 32 and 64 bit versions, older versions of Lazarus ide, FPC,Lnet. Really not a clue where to look. Just wondering if it got anything to do with my I9 Processor. Did anybody got Lazarus IDE including lnet running on an I9 ?

 

TinyPortal © 2005-2018