From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-ID: <407BCC0E.8040205@protei.ru> Date: Tue, 13 Apr 2004 15:16:30 +0400 From: =?KOI8-R?Q?=ED=C1=CB=D3=C9=CD?= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; ru-RU; rv:1.4) Gecko/20030630 X-Accept-Language: ru-ru, ru MIME-Version: 1.0 To: community@altlinux.ru Subject: Re: [Comm] =?KOI8-R?Q?=F0=D2=CF=C7=D2=C1=CD=C9=C9=D2=CF=D7=C1=CE?= =?KOI8-R?Q?=C9=C5=3A_multicast_=D7_TCP/IP?= References: <407BA443.7020109@protei.ru> <20040413150039.5c692721.Egor.Orlov@avalon.ru> In-Reply-To: <20040413150039.5c692721.Egor.Orlov@avalon.ru> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: community@altlinux.ru X-Mailman-Version: 2.1.4 Precedence: list Reply-To: community@altlinux.ru List-Id: Mailing list for ALT Linux users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Apr 2004 11:16:58 -0000 Archived-At: List-Archive: List-Post: Egor S. Orlov пишет: >On Tue, 13 Apr 2004 12:26:43 +0400 >Максим wrote: > > > >>Не работает multicast в ALTLinux 2.2 Master. Помогите !!! Как это исправить? >> >> >> > >что именно не работает? >маршрут в таблицу маршрутизации добавили? > > > > Есть код программы : #include #include #include #include #include #include #include #include #include #define STDTRACE(i) std::cout << __FILE__ << ":"<< __LINE__ << std::endl; Error(i); int Socket; socklen_t nlen; struct sockaddr_in Address,sto,From; struct in_addr addr; char Buf[512]; const short port = 100; void Error(int i); int main(int argc, char **argv) { bzero((char *)&sto,sizeof(sto)); addr.s_addr=inet_addr("225.0.0.1"); sto.sin_family=AF_INET; sto.sin_port=htons(port); sto.sin_addr=addr; nlen=sizeof(sockaddr_in); int ttl=7,one=1; struct ip_mreq mreq; if((Socket=socket(PF_INET,SOCK_DGRAM,IPPROTO_UDP))==-1) { STDTRACE(0); } Address.sin_family=AF_INET; Address.sin_port=htons(port); Address.sin_addr.s_addr=INADDR_ANY; if(bind(Socket,(struct sockaddr *)&Address,sizeof(Address))==-1) { STDTRACE(1); } if(setsockopt(Socket,IPPROTO_IP,IP_MULTICAST_TTL,&ttl,sizeof(ttl))==-1) { STDTRACE(2); } if(setsockopt(Socket,IPPROTO_IP,IP_MULTICAST_TTL,&ttl,sizeof(ttl))==-1) { STDTRACE(2); } bzero((char *)&mreq,sizeof(mreq)); mreq.imr_multiaddr.s_addr=inet_addr("225.0.0.1"); mreq.imr_interface.s_addr=INADDR_ANY; if(setsockopt(Socket,IPPROTO_IP,IP_ADD_MEMBERSHIP,&mreq,sizeof(mreq))==-1) { STDTRACE(2); //Вот здесь выскакивает ошибка !!!! } setsockopt(Socket,SOL_SOCKET,SO_REUSEADDR,&one,sizeof(one)); while(1) sleep(1); } void Error(int i) { char *errors[7]={"Error of socket", "Error of bind:port already busy", "Error of setsockopt", "Error of sending", "Error of gethostname", "Error of gethostbyname", "Error of ioctl"}; std::cout << errors[i] << " " <