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