poke.c 729 Bytes
#include <stdlib.h>
#include <stdio.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <linux/sockios.h>
#include <asm/ioctls.h>

int
main(int argc, char* argv[]) {
    int s = socket(PF_UNIX, SOCK_STREAM, 0);
    struct sockaddr_un sa;
    char buf[256];
    int rv, c, i;
#define NR_PEEK		16
    unsigned short peek[NR_PEEK];
    sa.sun_family = AF_UNIX;
    strcpy(sa.sun_path, "/tmp/u64_pokemux");
    if ((connect(s, (struct sockaddr*)&sa, sizeof sa)) < 0) {
	perror("connect");
	exit(1);
    }
    while(1) {
	if ((c = getchar()) == EOF || c == 'q') break;
	write(s, "", 1);
	read(s, peek, sizeof peek);
	for(i = 0; i < NR_PEEK; i++)
	    printf("%04x ", peek[i]);
	//printf("\n");
    }
    close(s);
    return 0;
}