I've had to revisit a program to send ACN1.31 DMX512A packets I whipped up
back in 2011 written under Delphi 7.
Now I'm using XE7 and other than the usual crap of having to change all char
to ansichar etc. the compiler now complains that socket.dcu is missing.
Turns out that was part of the Codegear library set:
C:\Program Files (x86)\CodeGear\RAD Studio\5.0\lib\Sockets.dcu
Which has the source at 
C:\Program Files (x86)\CodeGear\RAD
Studio\5.0\source\Win32\internet\Sockets.pas

I'm not sure I want to start porting library code from an older version of
Delphi so that brings me back to this forum.  Many years ago I did a bit
with twsocket.  It's probably the one constant library that stays current
with new versions of Delphi.  Although if I wanted to do cross platform
development with XE7 would it then still be compatible for an Android
platform?

The code fragments below show how little I use of Socket.pas.  Is this easy
to port to twsocket?
Thanks
John Dammeyer

TACNPacket = class
    private
    { Private declarations }
    DMX_MsgLength : integer;
    DMX_Sequence : BYTE;
    UdpSocket: TUdpSocket;

    public
    { Public declarations }
    Packet : TACNPacketRecord;
    procedure LoadPacket(buf : TDMXBuffer; len : integer );
    function ACNPacketSize : integer;
    function Connect(u : WORD) : BOOLEAN;
    procedure Send;
    procedure Disconnect;
  end;

function TACNPacket.Connect( u : WORD) : BOOLEAN;
begin
     Packet.Universe := swap(u);
     UdpSocket := TUdpSocket.Create(nil);
     UdpSocket.RemoteHost :=  '239.255.0.'+ IntToStr(u);
     UdpSocket.RemotePort := '5568';
     UdpSocket.LocalPort := '5568';
     UdpSocket.Open;
end;

procedure TACNPacket.Send;
begin
     UdpSocket.SendBuf(Packet,ACNPacketSize,0);
end;

procedure TACNPacket.Disconnect;
begin
     UdpSocket.Close;
end;


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to