| 144 | }; |
| 145 | |
| 146 | void TCPThreadFunc(void* userPtr, void* lsMemory) |
| 147 | { |
| 148 | printf("TCPThreadFunc thread started\n"); |
| 149 | |
| 150 | TCPArgs* args = (TCPArgs*)userPtr; |
| 151 | //int workLeft = true; |
| 152 | b3Clock clock; |
| 153 | clock.reset(); |
| 154 | b3Clock sleepClock; |
| 155 | bool init = true; |
| 156 | if (init) |
| 157 | { |
| 158 | unsigned int cachedSharedParam = eTCPIsInitialized; |
| 159 | |
| 160 | args->m_cs->lock(); |
| 161 | args->m_cs->setSharedParam(0, eTCPIsInitialized); |
| 162 | args->m_cs->unlock(); |
| 163 | |
| 164 | double deltaTimeInSeconds = 0; |
| 165 | int numCmdSinceSleep1ms = 0; |
| 166 | unsigned long long int prevTime = clock.getTimeMicroseconds(); |
| 167 | |
| 168 | #ifdef BT_ENABLE_CLSOCKET |
| 169 | b3Clock clock; |
| 170 | double timeOutInSeconds = 10; |
| 171 | |
| 172 | |
| 173 | bool isPhysicsClientConnected = true; |
| 174 | bool exitRequested = false; |
| 175 | |
| 176 | |
| 177 | if (!isPhysicsClientConnected) |
| 178 | { |
| 179 | printf("TCP thread error connecting to shared memory. Machine needs a reboot?\n"); |
| 180 | } |
| 181 | btAssert(isPhysicsClientConnected); |
| 182 | |
| 183 | printf("Starting TCP server using port %d\n", args->m_port); |
| 184 | |
| 185 | CPassiveSocket socket; |
| 186 | CActiveSocket* pClient = NULL; |
| 187 | |
| 188 | //-------------------------------------------------------------------------- |
| 189 | // Initialize our socket object |
| 190 | //-------------------------------------------------------------------------- |
| 191 | socket.Initialize(); |
| 192 | |
| 193 | socket.Listen("localhost", args->m_port); |
| 194 | |
| 195 | socket.SetBlocking(); |
| 196 | |
| 197 | int curNumErr = 0; |
| 198 | |
| 199 | #endif |
| 200 | |
| 201 | do |
| 202 | { |
| 203 |
nothing calls this directly
no test coverage detected