Re: [RTnet-developers] Ethernet IP
Brought to you by:
bet-frogger,
kiszka
|
From: Glen W. <gl...@je...> - 2011-01-25 23:48:48
|
Hi All, Well, I now have script to the point where I an ping non RTNET devices. I am now trying to get my RTNET stack to accept and send TCP and UDP packets from/to non RTNET stack devices. Again, I am only using RTNET for the real time NIC, UDP and TCP drivers. The Ethernet IP spec makes use of Administrative scoping broad cast address. To get my program working on non RTNET stack, I have to issue this routing command: route add -net 224.0.0.0 netmask 240.0.0.0 dev eth3 While the actual scope could be less than the command above, do you know how I would do the same command with RTROUTE which has difference syntax. Glen On 12/2/10 2:52 AM, "Jan Kiszka" <jan...@we...> wrote: > Am 01.12.2010 23:34, Glen Wernersbach wrote: >> Hi All, >> >> Back at this. My program now compiles. I think I am loading all the correct >> libraries to do just NIC, UDP and TCP with RTNET: >>> insmod /usr/realtime/modules/rtai_hal.ko >>> insmod /usr/realtime/modules/rtai_lxrt.ko >>> insmod /usr/realtime/modules/rtai_sem.ko >>> insmod /usr/realtime/modules/rtai_rtdm.ko >>> rmmod e1000e >>> insmod /usr/rtnet/modules/rtnet.ko >>> insmod /usr/rtnet/modules/rtipv4.ko >>> insmod /usr/rtnet/modules/rtpacket.ko >>> insmod /usr/rtnet/modules/rt_loopback.ko >>> insmod /usr/rtnet/modules/rt_e1000.ko >>> /usr/src/rtnet-0.9.12/tools/./rtifconfig rteth1 up 192.168.0.2 >>> /usr/src/rtnet-0.9.12/tools/./rtifconfig rtlo up 127.0.0.1 >>> insmod /usr/rtnet/modules/rtudp.ko >>> insmod /usr/rtnet/modules/rttcp.ko >>> ./opener 192.168.0.2 255.255.255.0 192.168.0.1 test.com testdevice 00 0E 8C >>> 9F >>> 16 09 >> >> I current am not connected to a host but am just trying to debug as far as a >> I can with this just this side. This all works until the last function: > > [ Note that functional debugging is also feasible in QEMU/KVM using e.g. > the emulated rtl8139. ] > >> >>> /* create a new TCP socket */ >>> if ((nTCPListener = rt_dev_socket(PF_INET, SOCK_STREAM, 0)) == -1) >>> { >>> OPENER_TRACE_ERR("error allocating socket stream listener, %d\n", >>> errno); >>> return EIP_ERROR; >>> } >>> >>> /* create a new UDP socket */ >>> if ((nUDPListener = rt_dev_socket(PF_INET, SOCK_DGRAM, 0)) == -1) >>> { >>> OPENER_TRACE_ERR("error allocating udp listener socket, %d\n", errno); >>> return EIP_ERROR; >>> } >>> >>> my_addr.sin_family = AF_INET; >>> my_addr.sin_port = htons(OPENER_ETHERNET_PORT); >>> my_addr.sin_addr.s_addr = htonl(INADDR_ANY); >>> memset(&my_addr.sin_zero, 0, sizeof(my_addr.sin_zero)); >>> >>> /* bind the new socket to port 0xAF12 (CIP) */ >>> if ((rt_dev_bind(nTCPListener, (struct sockaddr *) &my_addr, sizeof(struct >>> sockaddr))) >>> == -1) >>> { >>> OPENER_TRACE_ERR("error with bind: %d %s", errno, strerror(errno)); >>> return EIP_ERROR; >>> } >>> >>> /* enable the udp socket to receive broadcast messages*/ >>> y = 1; >>> if (0 > rt_dev_setsockopt(nUDPListener, SOL_SOCKET, SO_BROADCAST, &y, >>> sizeof(int))) >>> { >>> OPENER_TRACE_ERR("error with setting broadcast receive for udp socket: >>> %d %s", errno, strerror(errno)); >>> return EIP_ERROR; >>> } >> >> The above function returns ³38 function not implemented² >> >> Do I need to be connected for this to work? >> >> Are my load modules right? >> >> Is this function really not implemented or am I doing something wrong? >> >> If it is not implemented, is there a work around? > > SO_BROADCAST is indeed not implemented. RT-UDP sockets have this feature > automatically enabled. > > Jan > -- Glen Wernersbach President & CTO Jetsoft Development Co. 629 Old St Rt. 74 Suite 210 Cincinnati, Oh 45244 Custom Programming Web Site: www.jetsoftdev.com Retail Products Web Site: www.scanhelp.com Phone: 513-528-6660 Fax: 513-528-3470 ---- "Support Dyslexia Research" |