![Teracue ENC-100 MPEG-2 Encoder User Manual Download Page 44](http://html1.mh-extra.com/html/teracue/enc-100-mpeg-2-encoder/enc-100-mpeg-2-encoder_user-manual_1088250044.webp)
44
2.4.10.2
Example code for a Panasonic X?X camera
The application was used to send commands to a camera, waiting for a status and returning
a command.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <getopt.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
//-----------------------------------------------------------------------------
int main(int argc, char **argv)
{
extern char *optarg;
extern int optind;
const char *hostname = "192.168.3.44";
bool errflg = false;
while(1) {
int c = getopt(argc,argv,"h:");
if(c == -1)
break;
switch (c) {
case 'h':
hostname = optarg;
break;
default:
errflg = true;
}
}
if(errflg || optind!=argc) {
fprintf
( stderr,
"usage:\n"
" %s [-h numeric-hostname]\n",
argv[0]
);
exit(1);
}
//--------------------------------------------------
int fd = socket(AF_INET,SOCK_STREAM,IPPROTO_IP);
if(-1 == fd) {
perror("socket");
exit(1);
}
const int on = 1;