godotOscSharp/OscClient.cs

40 lines
926 B
C#
Raw Normal View History

2023-09-24 19:30:20 +02:00
using System;
using System.Net;
namespace godotOscSharp
{
public class OscClient
{
private readonly OscReceiver receiver;
private readonly OscSender sender;
public OscClient(IPAddress host, int port)
{
receiver = new OscReceiver(port);
sender = new OscSender(host, port);
}
public void SenderConnect() {
sender.Connect();
}
public void Send(OscMessage message) {
sender.Send(message);
}
public void AddMessageReceived(EventHandler<OscMessageReceivedEventArgs> func) {
receiver.MessageReceived += func;
}
public void AddErrorReceived(EventHandler<OscErrorReceivedEventArgs> func) {
receiver.ErrorReceived += func;
}
public void Dispose()
{
receiver.Dispose();
sender.Dispose();
}
}
2023-10-20 15:53:29 +02:00
}