I have a Server program, it works fine as a separate
executable, it uses recv() to receive any incoming
datas, this function blocks til it receive something.
Now, when i put the same code into a complicated
photon application under a Timer function, I need
to make recv() function nonblocking mode so TImer
will keep hitting. From the help, I used ioctl() functions as follows:
flag = 1 // to enable nonblocking
ioctl (sock, fiosnbio, &flag) before
the accept () function,
this works to make it nonblocking, but my tcpip
communication with my client is no longer established…
Do i need to put bind(), accept() function inside my timer function? in
another word, what do i need to do every time before receive any message
uing Recv()? re-bind, and re-accept?? I tried all that,
am I missing something else???
or there is no way to do it inside a timer …it has to be a separate
executable running in the background?
Another concern: if my timer runs slowly…would I
be running the risk of not receiving some of the message from my clients?
maybe putting in to a timer is a bad practice??
any help will be greatly appreciated!