Am 13.09.2010 16:30, Franz Engel wrote: > Hello, > > I have an problem and after one week I'm at one's wits' end. I wrote a client > that send a raw message to a second system. That works. Now I want to wait > for a > request form the second system befor I send my message. The second system > sends > an broadcast, but my program isn't able to receive that. Here is my code:
Already tried to capture the traffic as it leaves on the one node and arrives on the other via RTcap? Moreover, it looks like your a building IP frames. Who is supposed to process them on receiver side, the RTnet IP layer or another raw socket application? If the latter, did you disabled/unloaded the former? If the former, check if netmasks are correct. Jan > > RT_TASK *lxrtnettsk; > char msg[60]; > char msgRecv[60]; > > unsigned char src_mac[6] = {0x00, 0x10, 0xa7, 0x23, 0x4f, 0x17}; > int transmittionTime=1000;//Zeit in Milisekunden > int sendLoops = 2; > > static struct sockaddr_ll newAddr; > struct ifreq newIfr; > > struct ether_header *eth = (struct ether_header *)msg; > > int ret = 0; > int newSocket = 0; > int count = 0; > > sprintf(msg, "Used RTAI, RTnet and UDP!"); > system("sh ModuleEinbindenJitterTestXPC.sh"); > cout << msg << endl; > > mlockall(MCL_CURRENT|MCL_FUTURE); > memset(eth->ether_dhost, 0xFF, ETH_HLEN); > eth->ether_type=htons(0x1234); > strncpy(newIfr.ifr_name, "rteth0", IFNAMSIZ); > newSocket = rt_dev_socket(AF_PACKET, SOCK_RAW, 0); > > > //RAW communication > newAddr.sll_family = PF_PACKET; > newAddr.sll_protocol = htons(ETH_P_IP); > newAddr.sll_ifindex= 2; > newAddr.sll_hatype = 1;//ARPHRD_ETHER; > newAddr.sll_pkttype = PACKET_OTHERHOST; > newAddr.sll_halen = ETH_ALEN; > > //MAC - Begin > newAddr.sll_addr[0] = src_mac[0]; > newAddr.sll_addr[1] = src_mac[1]; > newAddr.sll_addr[2] = src_mac[2]; > newAddr.sll_addr[3] = src_mac[3]; > newAddr.sll_addr[4] = src_mac[4]; > newAddr.sll_addr[5] = src_mac[5]; > //MAC - End > newAddr.sll_addr[6] = 0x00; //not used > newAddr.sll_addr[7] = 0x00; //not used > > lxrtnettsk = rt_task_init(4800, 1, 0, 0); > if (NULL == lxrtnettsk) > { > rt_dev_close(newSocket); > printf("CANNOT INIT MASTER TASK\n"); > exit(1); > } > rt_make_hard_real_time(); > start_rt_timer(0); > ret = rt_dev_bind(newSocket, (struct sockaddr *)&newAddr, sizeof(newAddr)); > cout << "newBind: " << ret << endl; > while(count<sendLoops) > { > ret = rt_dev_recv(newSocket, msgRecv, 60, 0); > ret = rt_dev_send(newSocket, msg, sizeof(msg), 0); > rt_sleep(1000000); > count++; > } > > rt_make_soft_real_time(); > rt_dev_close(newSocket); > rt_task_delete(lxrtnettsk); > > Some Ideas? > > Regards, > Franz > >
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________ RTnet-users mailing list RTnet-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rtnet-users