14 int main(int argc
, char * argv
[])
17 char * host
= "127.0.0.1";
19 struct termios ti1
, ti2
;
23 int already_requested
= 0;
31 fd
= vncproto_init(host
, port
);
39 if (request_vnc_refresh(fd
) == -1)
41 tcsetattr(0, TCSANOW
, &ti2
);
50 retval
= select(fd
+1, &sel_in
, NULL
, NULL
, &tv
);
52 if (!already_requested
&& !must_redraw
&& !must_draw
) {
53 if (request_vnc_refresh(fd
) == -1)
55 already_requested
= 1;
57 if (must_draw
|| must_redraw
) {
58 must_draw
= drawdelta();
60 must_draw
=must_redraw
;
64 tv
.tv_sec
= stat
/byterate
;
65 tv
.tv_usec
= (stat
- tv
.tv_sec
*byterate
)*1000000/byterate
;
71 if (FD_ISSET(fd
, &sel_in
)) {
72 already_requested
= 0;
73 if (parse_vnc_in(fd
) == -1)
79 if (FD_ISSET(0, &sel_in
)) {
80 if (parse_kbd_in(0, fd
) == -1)
84 tcsetattr(0, TCSANOW
, &ti1
);
85 #define W(a,b) write((a),(b),strlen(b))