void GetClient() { int new_socket; char hello[256]; new_socket = accept(server_socket, 0, 0); #ifdef _WIN32 if (new_socket == INVALID_SOCKET) return; #else if (new_socket == -1) return; #endif if (client_socket) CloseClient(); client_socket = new_socket; #ifndef _WIN32 { int flags; flags = fcntl(client_socket, F_GETFL, 0); fcntl(client_socket, F_SETFL, flags | O_NONBLOCK); } #endif sprintf(hello, "000 PCSXR Version %s - Debug console\r\n", PACKAGE_VERSION); WriteSocket(hello, strlen(hello)); ptr = 0; }
int TCPSocket::write(LPVOID data, int buf_sz) { if (LISTENER) return -1; //printf("IN TCPSocket::write()\n"); return WriteSocket(sock, data, buf_sz); }
LWPR::SOCKET_RET_TYPE_E Socket::WriteSocket(SOCKET_FD_T fd, const char* buf, int length) { return WriteSocket(fd, buf, length, INT_MAX); }