Is anyone familiar with Aeron.NET using c#? I'm trying to simply open a connection to a multicast and am not able to do so. I can successfully use netcat to see a transmission to the 'udp' address but it will not connect.
Code
using System;
using System.Threading;
using Adaptive.Aeron.LogBuffer;
using Adaptive.Agrona;
using Adaptive.Agrona.Concurrent;
namespace AeronTest
{
class Program
{
public static void Main()
{
// aeron:udp?endpoint=224.9.10.11:12966
// StreamId: 11
const string channel = "aeron:udp?endpoint=224.9.10.11:12966";
const int streamId = 11;
var buffer = new UnsafeBuffer(new byte[256]);
var handler = HandlerHelper.ToFragmentHandler(PrintMessage);
try
{
using (var aeron = Adaptive.Aeron.Aeron.Connect())
using (var publisher = aeron.AddPublication(channel, streamId))
using (var subscriber = aeron.AddSubscription(channel, streamId))
{
var message = buffer.PutStringWithoutLengthUtf8(0, "Hello World!");
publisher.Offer(buffer, 0, message);
Console.WriteLine("Message sent...");
while (subscriber.Poll(handler, 1) == 0)
{
Thread.Sleep(10);
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
finally
{
Console.WriteLine("Press any key to continue...");
Console.ReadKey();
}
}
private static void PrintMessage(IDirectBuffer buffer, int offset, int length, Header header)
{
var message = buffer.GetStringWithoutLengthUtf8(offset, length);
Console.WriteLine($"Received message ({message}) to stream {header.StreamId:D} from session {header.SessionId:x} term id {header.TermId:x} term offset {header.TermOffset:D} ({length:D}@{offset:D})");
}
}
}
Error
Adaptive.Aeron.Exceptions.DriverTimeoutException: CnC file not created: C:\Users\user.name\AppData\Local\Temp\aeron-user.name\cnc.dat
at Adaptive.Aeron.Aeron.Context.WaitForFileMapping(FileInfo cncFile, IEpochClock clock, Int64 deadLineMs)
at Adaptive.Aeron.Aeron.Context.ConnectToDriver()
at Adaptive.Aeron.Aeron.Context.Conclude()
at Adaptive.Aeron.Aeron..ctor(Context ctx)
at Adaptive.Aeron.Aeron.Connect(Context ctx)
at Adaptive.Aeron.Aeron.Connect()
at AeronTest.Program.Main() in C:\Users\user.name\source\repos\AeronTest\AeronTest\Program.cs:line 25
Press any key to continue...
Successful netcat Here you can see using netcat I can successfully transmit a packet to the n/w address
C:\Program Files (x86)\Nmap>ncat -v -u -z -w 3 224.9.10.11 12966
Ncat: Version 7.92 ( https://nmap.org/ncat )
Ncat: Connected to 224.9.10.11:12966.
Ncat: UDP packet sent successfully
Ncat: 1 bytes sent, 0 bytes received in 2.03 seconds.
thank you