| 134 | } |
| 135 | |
| 136 | CScriptSocket* CScriptSocket::Accept(asINT64 timeoutMicrosec) |
| 137 | { |
| 138 | // Cannot accept a client on an ordinary socket or if the socket is not active |
| 139 | if (!m_isListening || m_socket == -1) |
| 140 | return 0; |
| 141 | |
| 142 | // First determine if there is anything to receive so that doesn't block |
| 143 | int r = Select(timeoutMicrosec); |
| 144 | if (r <= 0) |
| 145 | return 0; |
| 146 | |
| 147 | // TODO: need to be able to check to what ip address and port the socket is connected it (use getsockopt with SO_BSP_STATE) |
| 148 | // For each incoming client connection a new CScriptSocket is created |
| 149 | int clientSocket = (int)accept(m_socket, 0, 0); |
| 150 | if (clientSocket != -1) |
| 151 | { |
| 152 | CScriptSocket* client = new CScriptSocket(); |
| 153 | client->m_socket = clientSocket; |
| 154 | return client; |
| 155 | } |
| 156 | |
| 157 | return 0; |
| 158 | } |
| 159 | |
| 160 | int CScriptSocket::Close() |
| 161 | { |
nothing calls this directly
no outgoing calls
no test coverage detected