PDA

View Full Version : Port binding issue?



DocTauri
09-09-2006, 10:24 AM
I'm playing with ByRequest at Jamie's recommendation. What I'm messing with is running a TivoDesktop type app directly on my S2 DTV unit. I've built the cross compiler and it works fine. I've compiled ByRequest and put it on the unit, but whenever I try to run it, I get "Unable to bind address to socket", regardless of what port I use. Any suggestions as to what may be causing this? Obviously this kind of thing's possible (i.e. mfs_ftp, tivoweb, etc.) so it's something I'm doing wrong. Incidentally, this same code works fine on a standard linux box (fc4).

Thanks,
Doc

Jamie
09-09-2006, 11:07 AM
I'm playing with ByRequest at Jamie's recommendation. What I'm messing with is running a TivoDesktop type app directly on my S2 DTV unit. I've built the cross compiler and it works fine. I've compiled ByRequest and put it on the unit, but whenever I try to run it, I get "Unable to bind address to socket", regardless of what port I use. Any suggestions as to what may be causing this? Obviously this kind of thing's possible (i.e. mfs_ftp, tivoweb, etc.) so it's something I'm doing wrong. Incidentally, this same code works fine on a standard linux box (fc4).What's the ERRNO returned from the bind call?

Is it the beacon port it is trying to bind? If the tivo software is already bound to that port, another bind may fail. netstat -l will show you what parts are already bound.

You might look at what tivoserver does here. Seems like it tries to coexist with TiVoDesktop, so it may have the same problem fighting over the beacon port.

DocTauri
09-09-2006, 12:40 PM
I'm trying to bind to 8080, but netstat -ln shows 8080 is NOT in use.

I'm getting a 125, EADDRNOTAVAIL (Address not available). Remember though, I'm trying to run this directly on the Tivo, so there's no tivodesktop to contend with.

This is the code segment:



if( ( ( sock = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP ) ) == -1 ) )
{
addToLog( "Unable to open beacon socket\n" );
exit( 1 );
}

on = 1;
(void)setsockopt ( sock, SOL_SOCKET, SO_REUSEADDR, (void *)&on, sizeof(on));

if( bind( sock, ( struct sockaddr* ) &beacon, sizeof( struct sockaddr_in ) ) == -1 )
{
addToLog( "Unable to bind address to socket %d\n",errno );
exit( 2 );
}


The first section, opening the socket, is working, but it's when it binds the socket (the second section) that seems to fail.
Thanks for your help!
Doc

DocTauri
09-09-2006, 01:22 PM
Found it, it wasn't the 8080 it was bitching about, it was the 2190, which of course is already in use for mrv.

Thanks!
Doc

Jamie
09-09-2006, 05:38 PM
Found it, it wasn't the 8080 it was bitching about, it was the 2190, which of course is already in use for mrv.You might be able to just ignore failures to bind to the beacon port. That seems to be what tivoserver does. Does byRequest actually do anything with the data that comes in on the beacon port? It's just there to allow all the tivos on the LAN to know about each other.

DocTauri
09-10-2006, 12:55 AM
That's what it seems like, it binds to 2190 (which I believe is the MRV port), but doesn't really *DO* anything with it. As I don't intend to do any mrv either, I'll just strip the code using that port.

Thanks for you help, as always!
Doc

m.s
10-19-2006, 04:01 AM
If you have this working is it possible for you to post the compiled binaries? I'd love to be able to hear shoutcast on my Tivo without a pc on.

DocTauri
10-19-2006, 09:38 AM
Actually, I had been looking at it for a whole different project that really didn't include any mrv, shoutcast, etc, sorry. It does compile on mips though if you want to work on your own!

Doc

m.s
10-19-2006, 03:17 PM
I'm hoping for an easier solution. Thanks anyway :)