Posts

Post not yet marked as solved
5 Replies
If I understand correctly, To use Bonjour in a C# application, I will need to use a wrapper like Zeroconfig (a GitHub project) and add a dynamic library dependency in my Godot project Unfortunately, it appears that the zeroconfig wrapper only discovers services that broadcast a message with a service discovery format of DNS-SD Is there is a different wrapper that would let me discover packets with a BCON…. Pattern? Writing a custom wrapper for Bonjour would be a steep learning curve Is there a C# wrapper for Network framework or Gamekit?
Post not yet marked as solved
5 Replies
This is for a game. The only purpose for a multicast is to find the devices on the local network that are running the game. Once the device is found the rest of the communicatio is done with unicast. Unicast communications with the game works fine once the IPaddres is provided I would like to save the user of the game the hassle of finding the ip address of their device Im using Godot to develop the multiplatform game. Godot allows the use of their own script language or C# (Net 8.) The Godot script language appears to be a BSD socket as it required the interface to be specified. Finding the interface is less intuitive for regular users than finding an up address. So using Godot script has been abandoned Godot also allows the use of C# for its scripts. Using C# I have been able to run the game on Mac, Windows and Android platforms, but unfortunately not n apple devices. There is no need to specify the interface when using C# Since the application is being developed on a Godot game engine platform using objective-c is not an option I don’t know if it would be possible to have an objective-c section of code merged with the .NET export from Godot Another hack I’ve considered is creating a 10 line app in objective-c that be the multicast receiver and stuff the received IP addresses into a file that the primary app could read It might work but it would be an ugly solution It would be optimal make the C# solution work. Since C# is a Microsoft product and I’m trying to make it work on an Apple platform, who can I contact to resolve this cross-platform issue?
Post not yet marked as solved
2 Replies
Here is the start method for the app: Does UDPClient use BSD sockets 'under the hood'? public void Start() { try { OnLog = new LogHandler(LogHandlerMethod); _client = new UdpClient(); _client.Client.Bind(new IPEndPoint(IPAddress.Any, 0)); OnLog?.Invoke(String.Format("Client Local Endpoint is {0},", _client.Client.LocalEndPoint.ToString())); _ts = new CancellationTokenSource(); var token = _ts.Token; _serverTask = Task.Factory.StartNew(async () => { try { while (!token.IsCancellationRequested) { var response = await _client.ReceiveAsync().ConfigureAwait(false); // Check if the received data is from the specific endpoint var raw = Encoding.UTF8.GetString(response.Buffer); LastReceive = DateTime.Now; LastBuffer = response.Buffer; OnRawReceive?.Invoke(raw); ParseResponse(response.Buffer); } OnLog?.Invoke("Stopping server"); _client.Close(); } catch (Exception ex) { OnLog?.Invoke($"Exception in serverTask: {ex.Message}"); throw; } }, token, TaskCreationOptions.LongRunning, TaskScheduler.Default); _observerTask = Task.Factory.StartNew(async () => { try { while (!token.IsCancellationRequested) { foreach (var dr in _DataRefs) if (dr.Age > _MaxDataRefAge) RequestDataRef(dr); await Task.Delay(CHECKINTERVAL_MILLISECONDS).ConfigureAwait(false); } } catch (Exception ex) { OnLog?.Invoke(ex.ToString()); throw; } }, token, TaskCreationOptions.LongRunning, TaskScheduler.Default); } catch (Exception ex) { OnLog?.Invoke(String.Format("Error in Start method {0]", ex.ToString())); throw; } }