关于网络编程的有关问题,郁闷中.
关于网络编程的问题,郁闷中....
// Command Line Options:
// client [-p:x] [-s:IP] [-n:x] [-o]
// -p:x Remote port to send to
// -s:IP Server 's IP address or hostname
// -n:x Number of times to send message
// -o Send messages only; don 't receive
//
#include <winsock2.h>
#include <stdio.h>
#include <stdlib.h>
#define DEFAULT_COUNT 20
#define DEFAULT_PORT 5150
#define DEFAULT_BUFFER 2048
#define DEFAULT_MESSAGE "This is a test of the emergency \
broadcasting system "
char szServer[128], // Server to connect to
szMessage[1024]; // Message to send to sever
int iPort = DEFAULT_PORT; // Port on server to connect to
DWORD dwCount = DEFAULT_COUNT; // Number of times to send message
BOOL bSendOnly = FALSE; // Send data only; don 't receive
//
// Function: usage:
//
// Description:
// Print usage information and exit
//
void usage()
{
printf( "usage: client [-p:x] [-s:IP] [-n:x] [-o]\n\n ");
printf( " -p:x Remote port to send to\n ");
printf( " -s:IP Server 's IP address or hostname\n ");
printf( " -n:x Number of times to send message\n ");
printf( " -o Send messages only; don 't receive\n ");
ExitProcess(1);
}
//
// Function: ValidateArgs
//
// Description:
// Command Line Options:
// client [-p:x] [-s:IP] [-n:x] [-o]
// -p:x Remote port to send to
// -s:IP Server 's IP address or hostname
// -n:x Number of times to send message
// -o Send messages only; don 't receive
//
#include <winsock2.h>
#include <stdio.h>
#include <stdlib.h>
#define DEFAULT_COUNT 20
#define DEFAULT_PORT 5150
#define DEFAULT_BUFFER 2048
#define DEFAULT_MESSAGE "This is a test of the emergency \
broadcasting system "
char szServer[128], // Server to connect to
szMessage[1024]; // Message to send to sever
int iPort = DEFAULT_PORT; // Port on server to connect to
DWORD dwCount = DEFAULT_COUNT; // Number of times to send message
BOOL bSendOnly = FALSE; // Send data only; don 't receive
//
// Function: usage:
//
// Description:
// Print usage information and exit
//
void usage()
{
printf( "usage: client [-p:x] [-s:IP] [-n:x] [-o]\n\n ");
printf( " -p:x Remote port to send to\n ");
printf( " -s:IP Server 's IP address or hostname\n ");
printf( " -n:x Number of times to send message\n ");
printf( " -o Send messages only; don 't receive\n ");
ExitProcess(1);
}
//
// Function: ValidateArgs
//
// Description: