Chapter 2 101
Programming Examples
LAN Programming Examples
scan = argv[optind]+1;
optind++;
}
c = *scan++;
posn = strchr(optstring, c); /* DDP */
if (posn == NULL || c == ':') {
fprintf(stderr, "%s: unknown option -%c\n", argv[0], c);
return('?');
}
posn++;
if (*posn == ':') {
if (*scan != '\0') {
optarg = scan;
scan = NULL;
} else {
optarg = argv[optind];
optind++;
}
}
return(c);
}
Sockets LAN Programming Using PERL
This example uses PERL script to control the signal generator over the sockets LAN interface. The signal
generator power level is set to - 5 dBm, queried for operation complete and then queried for it’s identify
string. This example was developed using PERL version 5.6.0 and requires a PERL version with the
IO::Socket library. This example is available on the PSG Documentation CD-ROM as perl.txt.
1. In the code below, enter your signal generator’s hostname in place of the xxxxx in the code line: my
$instrumentName= “xxxxx”; .