- 论坛徽章:
- 0
|
多线程接收TCP带外数据的问题~~~~
I got an idea, maybe it works, maybe not, but at least you can try it.
first I dont think this is a good design at all.
second, if you really want to do it this way, then maybe as I think, you can use select() in each thread as well as select in the main thread. in the main thread, the select() just wait for listening socket fd, which in each worker threads you just can select its own conn_sock_fd(, because select is not so thread safe).
for example, in each worker thread, you can use:
...
FD_SET(rset,conn_sock_fd);//read fd_set
FD_SET(xset,conn_sock_fd);//out_bound_message fd_set
if ( n = select ( maxfd, &rset, NULL, &xset,...) ...)
{
...
/* if conn_sock_fd was set in xset , then read the OOB message here */
...
}
I do hope it works,
in any case, please let me know, OK? |
|