create OscClient
This commit is contained in:
parent
f5f3a5e527
commit
aa00d09708
41
OscClient.cs
Normal file
41
OscClient.cs
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
using System;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,7 +16,6 @@
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using Godot;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user