Skip to content

Commit

Permalink
Update actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Killers0992 committed Mar 10, 2024
1 parent bf29a13 commit 23206ae
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions VrcOscIntegrations/Services/OscActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,29 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
_sender = new UdpClient();

List<Task> tasks = new List<Task>()
{
Runner1()
};

_senderEndpoint = new IPEndPoint(IPAddress.Parse(MainConfig.Instance.OscClient.IpAddress), MainConfig.Instance.OscClient.Port);
Logger.Info("OscSender", $"Connect to IP: {MainConfig.Instance.OscClient.IpAddress}, Port: {MainConfig.Instance.OscClient.Port}.", Color.Yellow, Color.White);
_sender.Connect(_senderEndpoint);

_receiverEndpoint = new IPEndPoint(IPAddress.Parse(MainConfig.Instance.OscServer.IpAddress), MainConfig.Instance.OscServer.Port);
Logger.Info("OscReceiver", $"Start listening on IP: {MainConfig.Instance.OscServer.IpAddress}, Port: 9001.", Color.Yellow, Color.White);
_receiver = new UdpClient(_receiverEndpoint);
try
{
_receiverEndpoint = new IPEndPoint(IPAddress.Parse(MainConfig.Instance.OscServer.IpAddress), MainConfig.Instance.OscServer.Port);
Logger.Info("OscReceiver", $"Start listening on IP: {MainConfig.Instance.OscServer.IpAddress}, Port: {MainConfig.Instance.OscServer.Port}.", Color.Yellow, Color.White);
_receiver = new UdpClient(_receiverEndpoint);

await Task.WhenAll(new Task[]
tasks.Add(Runner2());
}
catch(Exception ex)
{
Runner1(),
Runner2()
});
Logger.Error("OscReceiver", $"Error thrown while trying to listen on port {MainConfig.Instance.OscServer.Port}, error {ex}", Color.Yellow, Color.Red);
}

await Task.WhenAll(tasks);
}

private async Task Runner1()
Expand Down

0 comments on commit 23206ae

Please sign in to comment.