#include #include #include #include #include #include #include #include #include #define SLIMPROTO_PORT 3483 int sockfd; struct sockaddr_in *client_addr; struct sockaddr_in *recv_addr; void slimproto_send_graphic(short offset, short length, short *buf) { int p,i; short frame[2048]; fprintf(stderr, "graphic, offs = %d, len = %d\n", offset, length); p=0; frame[p++] = htons(length+4+2); // 4 bytes for "grfd", 2 for offset frame[p++] = htons(('g' << 8) | 'r'); frame[p++] = htons(('f' << 8) | 'd'); // parameter for grfd command frame[p++] = htons(offset); for (i=0; isin_family = AF_INET; addr->sin_port = htons(port); addr->sin_addr = ip; return addr; } int slimproto_init(char *client_ip_address) { fprintf(stderr, "slimproto_init: %s\n", client_ip_address); if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) { perror("socket"); return(0); } client_addr = setupaddr(client_ip_address, SLIMPROTO_PORT); }