From 426287b62b43e2f8ab38f2f3ef44b28776cb6ff3 Mon Sep 17 00:00:00 2001 From: r618 Date: Mon, 23 Oct 2023 12:06:00 +0200 Subject: [PATCH] Properly expose and use buffer sizes for OscClient/OscWriter and OscServer Internal buffer sizes of OscClient and OscServer were hardcoded to 4096, this allows to customize this - needed when sending 4096b or larger blobs --- Runtime/Scripts/OscClient.cs | 4 ++-- Runtime/Scripts/OscServer.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Runtime/Scripts/OscClient.cs b/Runtime/Scripts/OscClient.cs index 1235f3d..2560f92 100644 --- a/Runtime/Scripts/OscClient.cs +++ b/Runtime/Scripts/OscClient.cs @@ -16,9 +16,9 @@ public class OscClient /// Where this client is sending messages to public IPEndPoint Destination { get; } - public OscClient(string ipAddress, int port) + public OscClient(string ipAddress, int port, int bufferCapacity = 4096) { - m_Writer = new OscWriter(); + m_Writer = new OscWriter(bufferCapacity); m_Socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); if (ipAddress == "255.255.255.255") diff --git a/Runtime/Scripts/OscServer.cs b/Runtime/Scripts/OscServer.cs index cba77dc..53748d3 100644 --- a/Runtime/Scripts/OscServer.cs +++ b/Runtime/Scripts/OscServer.cs @@ -87,12 +87,12 @@ public void Start() /// /// The port to listen for incoming message on /// - public static OscServer GetOrCreate(int port) + public static OscServer GetOrCreate(int port, int bufferSize = 4096) { OscServer server; if (!PortToServer.TryGetValue(port, out server)) { - server = new OscServer(port); + server = new OscServer(port, bufferSize); PortToServer[port] = server; } return server;