Skip to content

Commit

Permalink
Refactored where incoming data packets are processed
Browse files Browse the repository at this point in the history
  • Loading branch information
HakanL committed Jan 24, 2025
1 parent 7055a6a commit 9bebffe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/ArtNetClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,14 @@ public SendData(IPEndPoint destination)
//public event EventHandler<NewPacketEventArgs<RdmPacket>> NewRdmPacket;
//public event EventHandler<NewPacketEventArgs<RdmPacket>> RdmPacketSent;

public ArtNetClient(IPAddress localAddress, IPAddress localSubnetMask, int port = DefaultPort, UId? rdmId = null)
: base(ArtNetPacket.MAX_PACKET_SIZE)
public ArtNetClient(
IPAddress localAddress,
IPAddress localSubnetMask,
Func<ReceiveDataPacket, Task>? channelWriter = null,
Action? channelWriterComplete = null,
int port = DefaultPort,
UId? rdmId = null)
: base(ArtNetPacket.MAX_PACKET_SIZE, channelWriter, channelWriterComplete)
{
RdmId = rdmId ?? UId.Empty;

Expand All @@ -66,6 +72,8 @@ public ArtNetClient(IPAddress localAddress, IPAddress localSubnetMask, int port
this.sendSocket.Bind(new IPEndPoint(localAddress, 0));

this.sendSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1);

StartReceive();
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Haukcode.ArtNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<ProjectReference Include="..\..\Haukcode.HighPerfComm\src\Haukcode.HighPerfComm.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(UseProjectReference)' != 'true'">
<PackageReference Include="Haukcode.HighPerfComm" Version="1.0.19" />
<PackageReference Include="Haukcode.HighPerfComm" Version="1.0.20" />
</ItemGroup>

<Target Name="CopyProjectReferencesToPackage" DependsOnTargets="ResolveReferences">
Expand Down

0 comments on commit 9bebffe

Please sign in to comment.