oscpack to send and receive on same port

View: New views
2 Messages — Rating Filter:   Alert me  

oscpack to send and receive on same port

by Gaspard Bucher :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi List !

I'm working on the liboscit library and we talked about the fact that we do not need a "/.reply_to" method since we can just send that responses to the caller's IP and port.

That's fine except I can't seem to figure out how to define the outbound port using oscpack.

Anyone with oscpack knowledge ?

Gaspard

_______________________________________________
OSC_dev mailing list
OSC_dev@...
http://lists.create.ucsb.edu/mailman/listinfo/osc_dev

Re: oscpack to send and receive on same port

by Gaspard Bucher :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Found the solution. Basically, you need to first "bind" (define outgoing port) before doing "connect" (define target). With oscpack, this can be done by using the same socket for both received elements and sending answers back:

socket_ = new UdpListeningReceiveSocket( IpEndpointName( IpEndpointName::ANY_ADDRESS, port ), this );

... Run ...

void ProcessMessage(...) {
  socket_->Connect(remote_endpoint);
  socket_->Send(reply.Data(), reply.Size();
}

I will reflect this in liboscit by moving OscSend's message mangling into statics so that OscReceive can use it's own socket to send answers back.

Gaspard

On Mon, Mar 30, 2009 at 8:50 AM, Gaspard Bucher <gaspard@...> wrote:
Hi List !

I'm working on the liboscit library and we talked about the fact that we do not need a "/.reply_to" method since we can just send that responses to the caller's IP and port.

That's fine except I can't seem to figure out how to define the outbound port using oscpack.

Anyone with oscpack knowledge ?

Gaspard


_______________________________________________
OSC_dev mailing list
OSC_dev@...
http://lists.create.ucsb.edu/mailman/listinfo/osc_dev