Comments (1)
I think I found the cause:
SendTo calls Bytes method on packet (a osc message)
https://github.com/scgolang/osc/blob/master/udp.go#L106C29-L106C29
Bytes method of message calls Bytes method for arguments, in this case a String
https://github.com/scgolang/osc/blob/master/message.go#L58
https://github.com/scgolang/osc/blob/master/argument.go#L239
Bytes method of String calls ToBytes. ToBytes returns []byte{} when len(string) == 0
https://github.com/scgolang/osc/blob/master/osc.go#L46
Then Pad doesn't append any null character (it isn't called)
https://github.com/scgolang/osc/blob/master/osc.go#L55
ToBytes is also used for msg.Address and BundleTag :
https://github.com/scgolang/osc/blob/master/message.go#L54
https://github.com/scgolang/osc/blob/master/bundle.go#L79
Both can't be empty according to the OSC specs I think*.
And a empty string is tested:
https://github.com/scgolang/osc/blob/master/osc_test.go#L14
It expects: []byte{}
but in this case it should be the following I think:
[]byte{0,0,0,0}
From the specs: osc string = A sequence of non-null ASCII characters followed by a null, followed by 0-3 additional null characters
(
Not related to this issue I think, but ReadString has a similar way of handling empty strings
https://github.com/scgolang/osc/blob/master/osc.go#L71
)
Looking at the gosc library, it checks if a string has "\x00" as suffix and adds it when it doesn't have any, as is the case with a empty string.
https://github.com/loffa/gosc/blob/master/writer.go#L104
I think something similar is done in the go-osc library:
https://github.com/hypebeast/go-osc/blob/master/osc/osc.go#L1027
- https://github.com/scgolang/osc/blob/master/bundle.go#L13
- An OSC Address Pattern is an OSC-string beginning with the character ‘/’ (forward slash).
https://opensoundcontrol.stanford.edu/spec-1_0.html
from osc.
Related Issues (19)
- Make this package transport agnostic HOT 1
- Arguments types
- Use of pointers HOT 2
- match osc message based on address and types
- Loosing messages when using > 1 worker HOT 2
- Address matching, glob / wildcards HOT 9
- UnixConn read HOT 1
- Can't reconnect to a udp server HOT 1
- Bundle scheduling
- Not sure about a "return nil" in the PatternMatcher
- remove dependency https://github.com/pkg/errors HOT 5
- deserialise validation
- string $112 seems to be displayed as 12 HOT 2
- *UDPConn.Serve() leads to > 100% CPU load HOT 2
- Error in timetag to time.Time conversion HOT 2
- checkDispatcher checking the wrong things? HOT 1
- don't store context in structs
- TCP support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from osc.