HP-UX Multimedia Streaming Protocols (MSP) Programmer's Guide
* This Application uses the interfaces provided by the
* RTP library to transmit data
*
*/
/* Macros for handling time as double */
#define tv2dbl(tv) ((tv).tv_sec + (tv).tv_usec / 1000000.0)
#define dbl2prnt(x) ((int)((long)(x)))
,((int)(((int)(1000000.0*((double)(x))))%((int)1000000)))
/* function to print Usage for this program */
Usage(char *prg)
{
fprintf(stderr, “Usage: %s [-a local-address] [-p local-rtp-port]”
“ [-d dest-addr] [-r remote-rtp-port] n”,prg);
}
/* The main routine */
int main(int argc, char **argv)
{
char c;
/*
* by default:
* IPv4 is to be handled unless specified
* local ports 28000 for RTP and 28001 for RTCP are used
* loop back addresses are used
*/
int RTPport=28000,RTCPport;
int remRTPport=17000,remRTCPport;
char *caddr=”127.0.0.1”,*destaddr=”127.0.0.1”;
struct sockaddr_in addr[2];
int rd;
int ret;
struct sockaddr_in sin;
int i=0,x;
char ec=’y’;
while ((c = getopt(argc, argv, “6a:p:d:r:”))!=EOF)
{
switch(c)
{
case ‘a’:
caddr=optarg;
break;
case ‘p’:
RTPport=atoi(optarg);
break;
case ‘r’:
remRTPport=atoi(optarg);
break;
case ‘d’:
destaddr=optarg;
break;
default:
{
Usage(argv[1]);
exit(1);
}
}
86 Sample Programs