#include <string.h>
#include <strings.h>
#include <unistd.h>
+#include <signal.h>
#include "scope.h"
#include "commands.h"
}
}
+void sighandler(int sig)
+{
+ printf("Signal %d received\n", sig);
+}
+
int main(int argc, char **argv)
{
+ struct sigaction act;
int sock, csock;
int opt;
socklen_t slen;
unsigned short port = 8088;
sc = initscope();
+ if (sc == NULL) {
+ printf("Scope not found!\n");
+ exit(EXIT_FAILURE);
+ }
+
+ bzero(&act, sizeof(act));
+ act.sa_handler = sighandler;
+ act.sa_flags = SA_RESTART;
+ if (sigaction(SIGPIPE, &act, NULL) == -1) {
+ perror("sigaction");
+ exit(EXIT_FAILURE);
+ }
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
perror("socket");
#include "usbtmc.h"
-#define USB_TIMEOUT 10000
+#define USB_TIMEOUT 50000
//Helper-routine: Convert a little-endian 4-byte word to an int
static void int2chars(unsigned char *buff,unsigned int a) {