Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rudimentary PLH support #83

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

arlomedia
Copy link

When sending through TCP, OSC 1.0 uses a packet length header (PLH) (four bytes at the start of outgoing data) to indicate to the receiver how long the packet will be. The current TCP transport in JavaOSC doesn't add this PLH to outgoing data, so other OSC-compliant apps won't process the data correctly; and it doesn't read this PLH from incoming data, so it won't process the data from other OSC-compliant apps correctly.

This PR correctly adds the PLH to outgoing data. For incoming data, it simply discards the PLH. A more complete solution would use the PLH to correctly process incoming OSC messages that are split across multiple TCP packets.

@daveyarwood
Copy link
Collaborator

daveyarwood commented Feb 5, 2025

I took a quick stab at testing this, but it looks like the tests are failing when I run mvn install:

[ERROR] Failures:
[ERROR]   OSCPortTest.testBundleReceivingTCP:604->testBundleReceiving:586->assertMessageReceived:331->assertEventuallyTrue:98 Message was not received.
[ERROR]   OSCPortTest.testLowLevelBundleReceivingTCP:655->testLowLevelBundleReceiving:628->assertPacketReceived:351->assertEventuallyTrue:98 Packet was not received.
[INFO]
[ERROR] Tests run: 268, Failures: 2, Errors: 0, Skipped: 0

NOTE: There were also a couple of build errors before this, which I was able to fix by adding this import:

import com.illposed.osc.transport.NetworkProtocol;

in the following files:

  • OSCSerializer.java
  • OSCSerializerAndParserBuilder.java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants