IDUDPSERVER how to send message to all subscribed clients ? lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- drama22 · 2017-12-17 10:49 i am trying to work with udpserver but things gone mess here is my server app code Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit UDPSRV; interface uses  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, IdBaseComponent, IdComponent, IdUDPBase,  IdUDPServer, IdGlobal, IdSocketHandle, Vcl.StdCtrls; type  Tudpservfrm = class(TForm)    udpserver: TIdUDPServer;    Button1: TButton;    Button2: TButton;    Edit1: TEdit;    Memo1: TMemo;    procedure udpserverUDPRead(AThread: TIdUDPListenerThread;      const AData: TIdBytes; ABinding: TIdSocketHandle);    procedure Button1Click(Sender: TObject);  private    { Private declarations }  procedure UpdateBindings;  public    { Public declarations }  end; var  udpservfrm: Tudpservfrm; implementation {$R *.dfm} procedure Tudpservfrm.Button1Click(Sender: TObject);begin UpdateBindings;  udpserver.Active := true;end; procedure Tudpservfrm.udpserverUDPRead(AThread: TIdUDPListenerThread;  const AData: TIdBytes; ABinding: TIdSocketHandl e);begin////memo1.Lines.Add(bytestostring(AData));  end; procedure Tudpservfrm.UpdateBindings;varBinding: TIdSocketHandle;beginudpserver.DefaultPort := StrToInt(Edit1.Text);udpserver.Bindings.Clear;Binding := udpserver.Bindings.Add;Binding.IP := '0.0.0.0';Binding.Port := StrToInt(Edit1.Text);end; end. and here is my client code Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit udpfrm; interface uses  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, IdBaseComponent, IdComponent, IdUDPBase,  IdUDPClient, Vcl.StdCtrls, Vcl.ExtCtrls, IdUDPServer, IdGlobal, IdSocketHandle; type  TUDPClient = class(TForm)    Button1: TButton;    tmr1: TTimer;    Memo1: TMemo;    udpreciver: TIdUDPServer;    procedure Button1Click(Sender: TObject);    procedure tmr1Timer(Sender: TObject);    procedure udpreciverUDPRead(AThread: TIdUDPListenerThread;      const AData: TIdBytes; ABinding: TIdSocketHandle);    procedure udpreciverStatus(ASender: TObject; const AStatus: TIdStatus;      const AStatusText: string);  private  { Private declarations }  public    { Public declarations }  end; var  UDPClient: TUDPClient; implementation {$R *.dfm} procedure TUDPClient.Button1Click(Sender: TObject);begin  if not udpreciver.Active then  begin    udpreciver.Active := True;    udpreciver.Send('127.0.0.1',6754,'ping');    tmr1.Enabled := True;  end; {udpclient.Host := '127.0.0.1';udpclient.Port := 6754;udpclient.Connect;}end; procedure TUDPClient.tmr1Timer(Sender: TObject);begin  try if udpreciver.Active then    udpreciver.Send('127.0.0.1',6754,'ping');    except end;end; procedure TUDPClient.udpreciverStatus(ASender: TObject;  const AStatus: TIdStatus; const AStatusText: string);begin memo1.Lines.Add(AStatusText); end; procedure TUDPClient.udpreciverUDPRead(AThread: TIdUDPListenerThread;  const AData: TIdBytes; ABinding: TIdSocketHandle);beginmemo1.Lines.Add(bytestostring(AData));end; end. i am trying to run this client code on 2 computer on the same network , but each client cannot recive what the other client sent its only received its own data , how can i share data between other clients that subscribed on the same port ? ---------------------------------------------------------------------- Cyrax · 2017-12-17 11:13 Are you using Delphi or Lazarus to develop your program? ---------------------------------------------------------------------- Thaddy · 2017-12-17 12:09 Indeed that is Delphi code, not Freepascal/Lazarus. ---------------------------------------------------------------------- drama22 · 2017-12-17 12:34 i am using delphi is it make a difference ? ---------------------------------------------------------------------- Thaddy · 2017-12-17 12:56 Quote from: drama22 on December 17, 2017, 01:34:14 pmi am using delphi is it make a difference ? Yes. We do not support Delphi. ---------------------------------------------------------------------- Remy Lebeau · 2017-12-18 18:03 Quote from: drama22 on December 17, 2017, 11:49:38 ami am trying to work with udpserver but things gone mess here is my server app code ... i am trying to run this client code on 2 computer on the same network , but each client cannot recive what the other client sent its only received its own data , how can i share data between other clients that subscribed on the same port ? This topic has been discussed recently on the Embarcadero forums: https://forums.embarcadero.com/thread.jspa?threadID=271565 https://forums.embarcadero.com/thread.jspa?threadID=271565