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

setup_mcast_listener: bind: Address already in use #18

Open
qwerttvv opened this issue Mar 10, 2020 · 4 comments
Open

setup_mcast_listener: bind: Address already in use #18

qwerttvv opened this issue Mar 10, 2020 · 4 comments

Comments

@qwerttvv
Copy link

qwerttvv commented Mar 10, 2020

Now, there is 1.0-24.1 on my router, Dozens of channels can be switched freely and played perfectly, only one channel cannot be played, there will be such an error message in the background

However, the igmp address of this channel is playable, such as rtp: //239.3.1.209: 8052

rtp: //239.3.1.209: 8052 can play

http://192.168.123.1:2333/rtp/239.3.1.209:8052 cannot be played

All other channels are normal, but this one is problematic. The error is:

Mar 10 14:39:31 udpxy[10557]: setup_mcast_listener: bind: Address already in use
Mar 10 14:39:31 udpxy[10558]: setup_mcast_listener: bind: Address already in use

update

I found that there are other programs occupying 8052 port
I want to know from udpxy's perspective, is there any way to solve this problem?

@qwerttvv qwerttvv reopened this Mar 10, 2020
@pcherenkov
Copy link
Owner

Apply the following patch, test and let me know if it makes any difference:

--- a/chipmunk/netop.c +++ b/chipmunk/netop.c @@ -214,6 +214,7 @@ setup_mcast_listener( struct sockaddr_in* sa, "for mcast socket [%d]\n", sockfd ) ); }
  •    ON = 1;
       rc = setsockopt( sockfd, SOL_SOCKET, SO_REUSEADDR,
                        &ON, sizeof(ON) );
       if( 0 != rc ) {
    

@@ -226,6 +227,7 @@ setup_mcast_listener( struct sockaddr_in* sa,
/* On some systems (such as FreeBSD) SO_REUSEADDR
just isn't enough to subscribe to N same channels for different clients.
*/

  •    ON = 1;
       rc = setsockopt( sockfd, SOL_SOCKET, SO_REUSEPORT,
                        &ON, sizeof(ON) );
       if( 0 != rc ) {
    

The idea is to re-initialize the ON variable before SO_REUSEPORT.

Cheers.

@qwerttvv
Copy link
Author

Apply the following patch, test and let me know if it makes any difference:

--- a/chipmunk/netop.c +++ b/chipmunk/netop.c @@ -214,6 +214,7 @@ setup_mcast_listener( struct sockaddr_in* sa, "for mcast socket [%d]\n", sockfd ) ); }

  •    ON = 1;
       rc = setsockopt( sockfd, SOL_SOCKET, SO_REUSEADDR,
                        &ON, sizeof(ON) );
       if( 0 != rc ) {
    

@@ -226,6 +227,7 @@ setup_mcast_listener( struct sockaddr_in* sa,
/* On some systems (such as FreeBSD) SO_REUSEADDR
just isn't enough to subscribe to N same channels for different clients.
*/

  •    ON = 1;
       rc = setsockopt( sockfd, SOL_SOCKET, SO_REUSEPORT,
                        &ON, sizeof(ON) );
       if( 0 != rc ) {
    

The idea is to re-initialize the ON variable before SO_REUSEPORT.

Cheers.

Thx for you reply!

I found this
https://lists.freebsd.org/pipermail/freebsd-ports-bugs/2012-August/238797.html
and this
https://forum.lissyara.su/networks-f4/udpxy-freebsd-9-0-t35416.html

I will try to test that patch
I failed to cross-compilation before, I will try again

@pcherenkov
Copy link
Owner

I see that the recommendation is just to use SO_REUSEPORT in place of SO_REUSEADDR. My approach was to use both (if SO_REUSEPORT is defined), but perhaps the call to set SO_REUSEPORT was ignored if SO_REUSEADDR reset the ON variable.

Please test my patch, it's important to see if it fixes the issue mentioned in all these forums. I'll appreciate your effort.

@qwerttvv
Copy link
Author

I see that the recommendation is just to use SO_REUSEPORT in place of SO_REUSEADDR. My approach was to use both (if SO_REUSEPORT is defined), but perhaps the call to set SO_REUSEPORT was ignored if SO_REUSEADDR reset the ON variable.

Please test my patch, it's important to see if it fixes the issue mentioned in all these forums. I'll appreciate your effort.

Thanks to @hiboyhiboy for helping compile the patched file :)

Unfortunately, patch does not work, and still prompts an error with "setup_mcast_listener: bind: Address already in use"

But I have tried to solve this problem temporarily, I changed other programs port ; )

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

No branches or pull requests

2 participants