Recent

Author Topic: Synapse Multicast and Linux  (Read 2658 times)

ChristianH

  • New Member
  • *
  • Posts: 46
Synapse Multicast and Linux
« on: February 27, 2019, 05:41:14 pm »
Hi,

i do have a question, maybe somebody can help me with this. For a project i need to listen to a Multicast Port. My Code looks like this:

Code: Pascal  [Select][+][-]
  1. procedure TLineupManager.Execute;
  2. var
  3.   Socket: TUDPBlockSocket;
  4.   Len: integer;
  5.   LLS_table: PLLSHeader;
  6.   Buffer: TUDPBuffer; //Max Size of UDP Packet
  7. begin
  8.   Socket := TUDPBlockSocket.Create();
  9.   try
  10.     Socket.Family := SF_IP4;
  11.     Socket.bind('0.0.0.0', FPort);
  12.     Socket.AddMulticast(FHost);
  13.  
  14.     while not terminated do
  15.     begin
  16.       if Socket.CanRead(33) then
  17.       begin
  18.         Len := Socket.RecvBufferFrom(@Buffer[0], SizeOf(Buffer));
  19.         PerformData(Buffer, Len);      
  20.       end;
  21.  
  22.       sleep(0);
  23.     end;
  24.   finally
  25.     Socket.Free;
  26.   end;
  27. end;

This runs fine under Windows and is also tested under Android and iOS using Delphi. Anyhow it does not receive any data under linux and i have no idea why.

Christian

Mukatai

  • New Member
  • *
  • Posts: 28
Re: Synapse Multicast and Linux
« Reply #1 on: September 02, 2019, 05:37:36 pm »
Hello,

Did you find a solution ?

I have the same problem. My code work on Windows but not on linux i can't pass Socket.AddMulticast(). If i use the debugger on TUDPBlockSocket.AddMulticast(MCastIP: string), it block on Multicast.imr_multiaddr.S_addr := swapbytes(strtoip(MCastIP)). Error message : RunError(201).

I use this code for UPnP, i have an other UPnP program build with MiniUPnP and it work perfectly.

Thanks.
@+

Mukatai

  • New Member
  • *
  • Posts: 28
Re: Synapse Multicast and Linux
« Reply #2 on: September 02, 2019, 06:07:55 pm »
small clarification: The code work sometimes with Release mode but never with Default/Debug modes. (Only on Linux, on Windows it works in all modes)

 

TinyPortal © 2005-2018