[Live-devel] setup datagram socket fail
kingaceck
kingaceck at 163.com
Wed Dec 19 01:04:37 PST 2012
I use live555 for a multicast server.I use my client program to connect to the live555 16 times at one operation.
After openning and closing my client program,the live555 show errors:
16:47:39 Groupsock(-1: 225.1.1.10, 50822, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50824, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50826, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50828, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50830, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50832, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50834, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50836, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50838, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50840, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50842, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50844, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50846, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50848, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50850, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50852, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50854, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50856, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50858, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50860, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50862, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50864, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50866, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50868, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50870, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50872, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50874, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50876, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50878, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50880, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50882, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
16:47:39 Groupsock(-1: 225.1.1.10, 50884, 255): failed to join group: setsockopt(IP_ADD_MEMBERSHIP) error: Bad file descriptor
......
I find that after "sock = socket(AF_INET, type|SOCK_CLOEXEC, 0); " the sock value is -1 and the errno is 24.I creat the rtp groupsock like belows :
static portNumBits initialPortNum = 30000;//note that it is a static var
struct in_addr destinationAddress ;
destinationAddress.s_addr = our_inet_addr(fMulticastAddr);//fMulticastAddr comes from client's url
Port serverRTPPort(0);
Port serverRTCPPort(0);
Groupsock* rtpGroupsock;
Groupsock* rtcpGroupsock;
NoReuse dummy(envir()); // ensures that we skip over ports that are already in use
unsigned i = 1,j=0;
if(initialPortNum > 65530)//the max port is 65535
initialPortNum = 30000;
for (;i<3; initialPortNum += 2) {
serverRTPPort = initialPortNum;
j++;
if(j>10000)//if can't success after 10000 times try,may be there is a error.exit
{
fAfterGettingClientData = NULL;
return;
}
rtpGroupsock = new Groupsock(envir(), destinationAddress, serverRTPPort, 255);
if (rtpGroupsock->socketNum() < 0) {
envir() << "rtp:" << serverRTPPort<<"\n";
delete rtpGroupsock;
continue; // try again
}
serverRTCPPort = initialPortNum+1;
rtcpGroupsock = new Groupsock(envir(), destinationAddress, serverRTCPPort, 255);
if (rtcpGroupsock->socketNum() < 0) {
envir()<< "rtcp:" << serverRTCPPort<<"\n";
delete rtpGroupsock;
delete rtcpGroupsock;
continue; // try again
}
if(i == 1){// success
fRtpGroupsockAudio = rtpGroupsock;
fRtcpGroupsockAudio = rtcpGroupsock;
}else{
fRtpGroupsockVideo = rtpGroupsock;
fRtcpGroupsockVideo = rtcpGroupsock;
}
//envir() << "serverPortNum:" << initialPortNum << "\n";
i++;
}
I have try many days to resolve this.
Is there any error,please help me.Tank you very much.
2012-12-19
kingaceck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20121219/4d170020/attachment-0001.html>
More information about the live-devel
mailing list