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

Provide a way to get the local endpoint for a connected socket #18

Open
GoogleCodeExporter opened this issue Feb 18, 2016 · 0 comments
Open

Comments

@GoogleCodeExporter
Copy link

- What steps will reproduce the problem?

1. Create a UdpTransmitSocket and connect it to a remote endpoint, but don't 
call Bind().
2. Call LocalEndpointFor(), passing the (connected) remote endpoint, and you 
will get an assert because the code assumes the socket should be bound.

- What is the expected output? What do you see instead?

I would expect no assert, and to get the local endpoint.
The goal is to be able to create a UdpReceiveSocket sharing the same local port 
as another UdpTransmitSocket (which is perfectly valid).  However, in order to 
do this, you must be able to determine out what local endpoint (port) to use 
when binding your receiver.

- What version of the product are you using? On what operating system?

OS X 10.9.4, Xcode 5.1.1, oscpack 1.1.0 (the latest version).  I'm using it via 
openFrameworks (the ofxOsc add-on).

- Please provide any additional information below.

I spoke to Ross about this, and he provided me with some rough code to try out. 
 It adds a new method, UdpSocket::LocalEndpointForConnectedRemoteEndpoint(), as 
well as optimizing UdpSocket::LocalEndpointFor(), in the case where you're 
requesting the local endpoint for an already-connected remote endpoint.

I'm attaching a patch that implements this new functionality.  Sorry, it's from 
git, from within the openFrameworks repository...But it should show the 
required changes to three files: ip/UdpSocket.h, ip/posix/UdpSocket.cpp and 
ip/win32/UdpSocketWin.cpp.

Original issue reported on code.google.com by [email protected] on 26 Aug 2014 at 3:18

Attachments:

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

No branches or pull requests

1 participant