Compare commits
5 commits
0df4eebd91
...
main
Author | SHA1 | Date | |
---|---|---|---|
516dd498c2 | |||
3a2abc58e8 | |||
527cd1c5f3 | |||
7d31364977 | |||
548abe4349 |
1 changed files with 9 additions and 8 deletions
17
fbflut.c
17
fbflut.c
|
@ -1,4 +1,5 @@
|
|||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -63,7 +64,7 @@ void *handle_connection(void *socket_desc) {
|
|||
|
||||
if (xpos >= 0 && ypos >= 0 && xpos < fb_width && ypos < fb_height) {
|
||||
if (colorcode[0] == '\0') {
|
||||
sprintf(message, "PX %i %i %X\n",xpos,ypos,fbdata[ypos*fb_length+xpos]);
|
||||
sprintf(message, "PX %i %i %06X\n",xpos,ypos,fbdata[ypos*fb_length+xpos]);
|
||||
write(sock, message, strlen(message));
|
||||
continue;
|
||||
} else {
|
||||
|
@ -76,7 +77,7 @@ void *handle_connection(void *socket_desc) {
|
|||
continue;
|
||||
}
|
||||
if (!strcmp("SIZE", command)) {
|
||||
sprintf(message, "SIZE %i %i\n\0", fb_width, fb_height);
|
||||
sprintf(message, "SIZE %i %i\n", fb_width, fb_height);
|
||||
write(sock, message, strlen(message));
|
||||
continue;
|
||||
}
|
||||
|
@ -126,15 +127,15 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
memset(fbdata, 0, fb_data_size); // clear the screen
|
||||
|
||||
|
||||
|
||||
int socket_desc, client_sock, c;
|
||||
struct sockaddr_in server, client;
|
||||
struct sockaddr_in6 server, client;
|
||||
|
||||
socket_desc = socket(AF_INET, SOCK_STREAM, 0);
|
||||
socket_desc = socket(AF_INET6, SOCK_STREAM, 0);
|
||||
|
||||
server.sin_family = AF_INET;
|
||||
server.sin_addr.s_addr = INADDR_ANY;
|
||||
server.sin_port = htons(port);
|
||||
server.sin6_family = AF_INET6;
|
||||
server.sin6_addr = in6addr_any;
|
||||
server.sin6_port = htons(port);
|
||||
|
||||
struct timeval tv;
|
||||
tv.tv_sec = 60;
|
||||
|
|
Loading…
Reference in a new issue