Non-blocking accept() function for sockets
BlitzMax Forums/BlitzMax Programming/Non-blocking accept() function for sockets
| ||
Ok, I have created a Socket server... The only problem I have is that the Accept() statement blocks... meaning that while it is waiting for a connection, nothing in the program happens. There doesn't appear to be any command defined for setting the blocking status. In unix you would use fcntl with the proper flag, but that doesn't work on windows. |
| ||
See the ioctlsocket command. |
| ||
alternitavely you could look at Antony's multithread module and then accept sockets in different thread? |
| ||
I wouldn't put a lot of trust in multithreading. Needlessly complex. |
| ||
Hi, 'select_' with a 0 timeout should let you poll a socket. |
| ||
select_ ??? whats that... |
| ||
Thanks for the info Mark... I figured that select_ would do something like that... but unlike the other commands, it was hard to figure it out from the C and Python tutorials how it translates to Blitz. A brief explanation of how select works in Blitz would be greatly appreciated (it isn't covered in the docs)! |
| ||
msdn is you friend: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/select_2.asp |
| ||
MSDN is _NOT_ your friend! :] |
| ||
MSDN doesn't explain what the blitz equivalent to a "set of sockets" is. Is it a TList, an array... Do I write to a bank with Int values and pass the pointer? And how do figure out what WSAENETDOWN constant is? Or the WSAENOTSOCK constant? |
| ||
Ooooo its a winsock function. I was looking through everything getting puzzled XD. Classic ¬_¬ |