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

How do I receive data from server? #24

Closed
mron opened this issue Apr 4, 2022 · 7 comments
Closed

How do I receive data from server? #24

mron opened this issue Apr 4, 2022 · 7 comments
Labels

Comments

@mron
Copy link

mron commented Apr 4, 2022

The SuperColliderClient example shows
// get and print out frequency number from SuperCollider let getFrqMessage = OSCMessage(address: "/s_get", args: [synthID, "freq"]) try channel.writeAndFlush(getFrqMessage, target: remoteAddr)

I don't see how to get and process the response. How is it done?

@segabor
Copy link
Owner

segabor commented Apr 4, 2022

The mentioned example consumes packets received from server in debugOSCPacket() function. Technically this block

  let bootstrap = DatagramBootstrap(group: group)
      .channelOption(ChannelOptions.socket(SocketOptionLevel(SOL_SOCKET), SO_REUSEADDR), value: 1)
      .channelInitializer { channel in
          channel.pipeline.addHandlers([OSCPacketReader(), OSCDebugHandler()])
  }

sets up the pipeline where the last chain OSCDebugHandler calls debugOSCPacket with the unwrapped packet.

@mron
Copy link
Author

mron commented Apr 4, 2022

Thanks for replying! What port is it listening on?

@segabor
Copy link
Owner

segabor commented Apr 5, 2022

According to below network configuration

let channel = try bootstrap.bind(host: "127.0.0.1", port: 57150).wait()
let remoteAddr = try SocketAddress(ipAddress: "127.0.0.1", port: 57110)

the client is expecting responses on port 57150.

@mron
Copy link
Author

mron commented Apr 5, 2022

Thanks,
That's what I expect. The client is getting messages. They aren't being sent up the pipeline. I have a break in singleReadFromSocket() and there is data in the buffer.

I'll keep looking into this.

@mron
Copy link
Author

mron commented Apr 6, 2022

I got it to work. I changed all references to:
(cxt: to (context:

@segabor
Copy link
Owner

segabor commented Apr 7, 2022

Awesome!

@segabor
Copy link
Owner

segabor commented Apr 7, 2022

Thanks for discovering the issue! I fixed it (see #25)

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

No branches or pull requests

2 participants