hi, i migrated from mqx 4.1 to mqx4.2, i use CW 10.6 and frmk64f.
in my application i used the RTCS_selectset() functionand it work properly; i read in the documentation of the rtcs that is recommended the use of the select() function. i seen the example and i try to use it with some changes. everything is ok till i use the RTCS_FD_CLR() function.
my application comunicates with my pc so i use a set of socket and i must check the activity of those sockets. i'm inside a while cycle and sometimes i need to add or remove a socket from the set. adding socket happens correctly but when i try to remove the socket from the set i have some problems:
-if i use the RTCS_FD_CLR() function, when the cycle come again on the select() function it return a error 0x1716 that in rtcs_err.h is RTCSERR_SOCK_EBADF. I seen that is a error returned when the select() function check if the socket is in the socket set.
if i do not use the RTCS_FD_CLR(), the select() function return the same error.
so my question is: there is a way to use correctly the RTCS_FD_CLR() function? or there is a way to know if i use correctly this function?
now i'm trying to clear all the set and i add again all the socket i need.
a very semplified version of my cycle is:
while(1){
err=select(active_socket_number,&sock_set,NULL,NULL, 0);
...
else{
if(RTCS_FD_ISSET(serv_sock, &sock_set)){
accept(...);
RTCS_FD_SET(sock,&sock_set);
active_socket_number++;
...
} else {
rx_count=recv(sock,buf,buf_size);
if (rx_count==RTCS_ERROR) {
RTCS_FD_CLR(sock,&sock_set)
closesock(sock);
active_socket_number--;
...
}
...
}
...
}
ps: i use multiple select() function of different set of sockets in different task. But those different set may contain the same socket. can this be the problem?