serverAddr.inet.port = PR_htons(BASE_PORT);
serverAddr.inet.port = listenAddr.inet.port;
ClientThread(void *_action){    PRInt32 action = * (PRInt32 *) _action;    PRInt32 iterations = count;    PRFileDesc *sock = NULL;    serverAddr.inet.family = PR_AF_INET;    serverAddr.inet.port = PR_htons(BASE_PORT);    serverAddr.inet.ip = PR_htonl(PR_INADDR_LOOPBACK);    for (; iterations--;) {        PRInt32 rv;        char buf[CLIENT_DATA];        memset(buf, 0xaf, sizeof(buf)); /* initialize with arbitrary data */        sock = PR_NewTCPSocket();        if (!sock) {            if (!debug_mode)                failed_already=1;            else                    PR_fprintf(output, "client: unable to create socket\n");            return;        }        if (action != CLIENT_TIMEOUT_ACCEPT) {            if ((rv = PR_Connect(sock, &serverAddr,                timeoutTime)) < 0) {                if (!debug_mode)                    failed_already=1;                else                        PR_fprintf(output,                         "client: unable to connect to server (%ld, %ld, %ld, %ld)\n",                        iterations, rv, PR_GetError(), PR_GetOSError());                goto ErrorExit;            }            if (action != CLIENT_TIMEOUT_SEND) {                if ((rv = PR_Send(sock, buf, CLIENT_DATA,                    0, timeoutTime))< 0) {                    if (!debug_mode)                        failed_already=1;                    else                            PR_fprintf(output,                             "client: unable to send to server (%d, %ld, %ld)\n",                            CLIENT_DATA, rv, PR_GetError());                	goto ErrorExit;                }            } else {                PR_Sleep(PR_SecondsToInterval(TIMEOUTSECS + 1));            }        } else {            PR_Sleep(PR_SecondsToInterval(TIMEOUTSECS + 1));        }        if (debug_mode)            PR_fprintf(output, ".");        PR_Close(sock);		sock = NULL;    }    if (debug_mode)        PR_fprintf(output, "\n");ErrorExit:	if (sock != NULL)        PR_Close(sock);}