Hi,Jan
In the source codes of ut_sock_init (void) :you can see this sequence :
1--> struct rtnet_callback callback = {cb_recv, NULL};
/* create rt-socket */
2--> sock = socket_rt(AF_INET, SOCK_DGRAM, 0);
/* extend the socket pool */
3--> ret = ioctl_rt(sock, RTNET_RTIOC_EXTPOOL, &add_rtskbs);
/* bind the rt-socket to a port */
4-->memset(&local_addr, 0, sizeof(struct sockaddr_in));
local_addr.sin_family = AF_INET;
local_addr.sin_port = htons(PORT);
local_addr.sin_addr.s_addr = INADDR_ANY;
ret = bind_rt(sock, (struct sockaddr *)&local_addr, sizeof(struct
sockaddr_in));
/* set destination address */
memset(&dest_addr, 0, sizeof(struct sockaddr_in));
dest_addr.sin_family = AF_INET;
dest_addr.sin_port = htons(PORT);
dest_addr.sin_addr.s_addr = dest_ip;
/* set up callback handler */
5--> ioctl_rt(sock, RTNET_RTIOC_CALLBACK, &callback);
it is the example from RTNET 0.7.0, does this implemetation register
the reception callback after binding to the port? Is it a wrong
order?
this source codes applied in the slave. If it is wrong, what is the
correct sequence of it?
Thank you very much!
Kity
------------------------------------------------------------------------------
_______________________________________________
RTnet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rtnet-users