tmocon.c revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-2000 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License Version 2 or later (the
* "GPL"), in which case the provisions of the GPL are applicable
* instead of those above. If you wish to allow use of your
* version of this file only under the terms of the GPL and not to
* allow others to use your version of this file under the MPL,
* indicate your decision by deleting the provisions above and
* replace them with the notice and other provisions required by
* the GPL. If you do not delete the provisions above, a recipient
* may use your version of this file under either the MPL or the
* GPL.
*/
/***********************************************************************
**
** Name: tmocon.c
**
** Description: test client socket connection.
**
** Modification History:
** 19-May-97 AGarcia- Converted the test to accomodate the debug_mode flag.
** The debug mode will print all of the printfs associated with this test.
** The regress mode will be the default mode. Since the regress tool limits
** the output to a one line status:PASS or FAIL,all of the printf statements
** have been handled with an if (debug_mode) statement.
***********************************************************************/
/***********************************************************************
** Includes
***********************************************************************/
/* Used to get the command line option */
#include "plgetopt.h"
#include "nspr.h"
#include "pprio.h"
#include "plerror.h"
#include "plgetopt.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* for getcwd */
#include <unistd.h>
#include <direct.h>
#endif
#ifdef XP_MAC
#include "prlog.h"
#define printf PR_LogPrint
#endif
#define BASE_PORT 9867
#define DEFAULT_DALLY 1
#define DEFAULT_THREADS 1
#define DEFAULT_TIMEOUT 10
#define DEFAULT_MESSAGES 100
#define DEFAULT_MESSAGESIZE 100
typedef struct Shared
{
} Shared;
{
{
}
return timeout;
} /* Timeout */
{
} /* CauseTimeout */
{
{
char *argv[3];
#ifdef XP_PC
#endif
{
}
if (PR_SUCCESS == rv)
{
return rv;
}
}
return rv;
} /* MakeReceiver */
{
descriptor.checksum = 0;
{
}
{
if (clientSock)
{
/*
* We need to slow down the rate of generating connect requests,
* otherwise the listen backlog queue on the accept side may
* become full and we will get connection refused or timeout
* error.
*/
{
char buf[128];
}
rv = PR_Connect(
if (PR_SUCCESS == rv)
{
shared->message_length : 0;
if (bytes != sizeof(descriptor))
{
}
if (0 != descriptor_length)
{
if (bytes != descriptor_length)
{
}
}
{
}
}
else
{
{
}
else
{
break;
}
}
}
else
{
break;
}
}
} /* Connect */
{
/*
* USAGE
* -d turn on debugging output (default = off)
* -v turn on verbose output (default = off)
* -h <n> dns name of host serving the connection (default = self)
* -i dally intermittantly to cause timeouts (default = off)
* -m <n> number of messages to send (default = 100)
* -s <n> size of each message (default = 100)
* -t <n> number of threads sending (default = 1)
* -G use global threads (default = local)
* -T <n> timeout on I/O operations (seconds) (default = 10)
* -D <n> dally between connect requests (seconds)(default = 0)
* -R randomize the dally types around 'T' (default = no)
*/
int exitStatus;
{
if (PL_OPT_BAD == os) continue;
{
case 'd':
break;
case 'v':
break;
case 'i':
break;
case 'R':
break;
case 'G':
break;
case 'h': /* the value for backlock */
{
char buffer[1024];
(void)PR_GetHostByName(
}
break;
case 'm': /* number of messages to send */
break;
case 't': /* number of threads sending */
break;
case 'D': /* dally time between transmissions */
break;
case 'T': /* timeout on I/O operations */
break;
case 's': /* total size of each message */
break;
default:
break;
}
}
PR_JOINABLE_THREAD, 0);
return exitStatus;
}
{
return (PR_VersionCheck(PR_VERSION)) ?
} /* main */
/* tmocon.c */