24/03/2021 11:09:19 Pixel format for client 192.168.0.6: 24/03/2021 11:09:19 87 bpp, depth 5, little endian 24/03/2021 11:09:19 true colour: max r 47360 g 20997 b 2, shift r 179 g 0 b 77 24/03/2021 11:09:19 rfbSetTranslateFunction: client bits per pixel not 8, 16 or 32 24/03/2021 11:09:19 Client 192.168.0.6 gone
/* This call creates a mask and then a cursor: */ /* rfbScreen->defaultCursor = rfbMakeXCursor(exampleCursorWidth,exampleCursorHeight,exampleCursor,0); */
MakeRichCursor(rfbScreen);
/* initialize the server */ rfbInitServer(rfbScreen);
#ifndef BACKGROUND_LOOP_TEST #ifdef USE_OWN_LOOP { int i; for(i=0;rfbIsActive(rfbScreen);i++) { fprintf(stderr,"%d\r",i); rfbProcessEvents(rfbScreen,100000); } } #else /* this is the blocking event loop, i.e. it never returns */ /* 40000 are the microseconds to wait on select(), i.e. 0.04 seconds */ rfbRunEventLoop(rfbScreen,40000,FALSE); #endif /* OWN LOOP */ #else #if !defined(LIBVNCSERVER_HAVE_LIBPTHREAD) && !defined(LIBVNCSERVER_HAVE_WIN32THREADS) #error "I need pthreads or win32 threads for that." #endif /* catch Ctrl-C to set a flag for the main thread */ signal(SIGINT, intHandler); /* this is the non-blocking event loop; a background thread is started */ rfbRunEventLoop(rfbScreen,-1,TRUE); fprintf(stderr, "Running background loop...\n"); /* now we could do some cool things like rendering in idle time */ while (maintain_connection) { sleep(5); /* render(); */ } fprintf(stderr, "\nShutting down...\n"); rfbShutdownServer(rfbScreen, TRUE); #endif /* BACKGROUND_LOOP */
revind / revind.so / run / websockify 는 websockify 에서 나온거
libvncserver 와 noVNC와 websockify 의 조합으로 어찌 되긴 하는데..
~/libvncserver/webclients $ ls -al total 64 drwxr-xr-x 4 pi pi 4096 Aug 12 11:44 . drwxr-xr-x 16 pi pi 4096 Aug 12 11:03 .. -rwxr-xr-x 1 pi pi 25372 Aug 12 11:02 example -rw-r--r-- 1 pi pi 1601 Aug 12 10:32 index.vnc drwxr-xr-x 10 pi pi 4096 Aug 12 11:00 novnc -rwxr-xr-x 1 pi pi 424 Aug 12 11:39 rebind -rwxr-xr-x 1 pi pi 7508 Aug 12 11:39 rebind.so -rwxr-xr-x 1 pi pi 78 Aug 12 11:39 run drwxr-xr-x 3 pi pi 4096 Aug 12 11:28 websockify
인자는 아래와 같이 하고 실행!
$ ./run 5900 -- ./example
웹 브라우저에서 http://ip:5800 으로 접속하면 아래와 같이 뜨고
별다른 설정을 하지 않았다면 wss(websocket secure)를 안될테니 위에 "Click here to connect using noVNC"를 누른다.
약간의 시간을 기다리면(libvncserver의 웹 서버가 느린지 파일 전송이 좀 느리다)
아래와 같이 쨘~
+
한번 되더니 websockify 없이도 되네.. 머지?
+
runInBackground 의 값을 TRUE 로 해주면 웹 서버가 작동을 안한다 -_-
어떻게 해야 할까..
void rfbRunEventLoop ( rfbScreenInfoPtr screenInfo, long usec, rfbBool runInBackground )
static THREAD_ROUTINE_RETURN_TYPE listenerRun(void *data) { rfbScreenInfoPtr screen=(rfbScreenInfoPtr)data; int client_fd; struct sockaddr_storage peer; rfbClientPtr cl = NULL; socklen_t len; fd_set listen_fds; /* temp file descriptor list for select() */
/* Only checking socket state here and not using rfbIsActive() because: When rfbShutdownServer() is called by the client, it runs in the client-to-server thread's context, resulting in itself calling its own the pthread_join(), returning immediately, leaving the client-to-server thread to actually terminate _after_ the listener thread is terminated, leaving the client list still populated. */ /* TODO: HTTP is not handled */ }
Programs supportinf older versions of uinput interface need to fill a uinput_user_dev structure and write it to the uinput file descriptor to configure the new uinput device