-
Notifications
You must be signed in to change notification settings - Fork 1
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
send and receive from client? #8
Comments
The standards of the server/client model is that the server listens for incoming connections, and replies to them if needed. The server have no idea that a client exist until that client connect and sends a message. There are no other OSC Server implementations that randomly can send data to a client, since this would mean the roles where reversed. If you initiate the connection, you are the client... A software can be both a server and a client (bi-directional communication). If you want to reply to any OSC message received to the server this can be handled in the The link to go-osc you provided adds the same functionality as my |
Thanks, makes sense I think. I didn't manage yet to get a reply (could be me), but looking at the code, there is no timeout functionality, so you get stuck when there is no reply. Given that it's udp, a reply is not guaranteed afaik. I found a example of such timeout here: |
Firstly UDP and TCP does not govern the application response protocol (OSC in this case). An UDP connection is not guaranteed to deliver packets, TCP uses a ack principle for ensuring that the package is delivered. But the OSC Server in use is not made to send a response on the application level either way. The |
I see. Got it working with c.SendMessage and a c.ReceiveMessageFunc. Then I can imagine (as a newbie) it would be handy to be able to pass a chan (done) variable to that ReceiveMessageFunc, that's a technique which I saw a lot in this package: Now the question is why c.SendAndReceiveMessage didn't work I guess. |
I was able to make a new type (pointer bool field in a struct is what I did), then add a oscMessageHandler as method of that new type and then set the bool to true if a 'pong' has received. Then main can exit. type Ping struct { func (p *Ping) oscMessageHandler(msg *gosc.Message) { // main client.ReceiveMessageFunc("/pong", pong.oscMessageHandler) Then a for (while) loop in main to check if pong.done is still false. edit: or using a global variable. |
All though your server client distinction makes sense in general, I still don't think this strict distinction is correct when it comes to OSC. I think a application can be both server and client (maybe the wrong wording then). This is also implemented by the much used liblo library it seems: "Send a OSC formatted message to the address specified, from the same socket as the specified server. " http://liblo.sourceforge.net/docs/group__liblo.html#gaa4a314562b09e2fd00749a5d0b4d0955 "The unit of transmission of OSC is an OSC Packet. Any application that sends OSC Packets is an OSC Client; any application that receives OSC Packets is an OSC Server." But in Best Practices for Open Sound Control document: "This distinction is not necessary" "4.6 Network Topology and Routing |
https://pkg.go.dev/github.com/loffa/gosc#Client.SendAndReceiveMessage
Other osc implementations are sending from a server, which then is able to receive a reply.
http://dsacre.github.io/pyliblo/doc/
"To enabled this a SendTo (analogue to PacketConn.WriteTo) was added to the Server struct. "
hypebeast/go-osc#51
The text was updated successfully, but these errors were encountered: