bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: keypad & non-default terminal


From: Rob King
Subject: Re: keypad & non-default terminal
Date: Wed, 3 May 2017 16:07:25 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

Hi,

Calling nodelay, etc. cannot set the other end of the connection's buffering. Are you in control of the code on the client side? You'll need to set it to be unbuffered when waiting for input on the client side before establishing the connection to the server.

Depending on what you're trying to do, you might also want to set TCP_NODELAY using setsockopt(2) on the client side, though that might be overkill.

    Thanks!


(Please note that I am not affiliated with the ncurses project; just trying to help.)

(Replying to the list this time.)

On 05/03/2017 02:43 PM, folkert wrote:
Hi,

I have a program which accepts network connections and then maps an
ncurses session on them:

void loop()
{
        int fd = accept(...)

         FILE *fh = fdopen(fd, "rw");

         SCREEN *scr = newterm("ansi", fh, fh);
        set_term(scr);

         WINDOW *win = newwin(25, 80, 0, 0);

         start_color();
         cbreak();
         keypad(win, TRUE);
         intrflush(win, FALSE);
         nodelay(win, FALSE);
         meta(win, TRUE);
         idlok(win, TRUE);
         idcok(win, TRUE);
         leaveok(win, FALSE);

        for(;;)
                printf("[%d]", wgetch(win));
}

Now I would expect to get values like 0522 for page down and 0523 for
page down but instead:
- it waits for enter on the screen in which the program is started, NOT
   the network connection
- the key pressed is printed as garbage on the network connection: ^[[5~
- the key is returned as a bunch of characters instead
   ([27][91][53][126])

So it looks like that cbreak and keypad are ignored while wgetch not
only listens on the fd given by newterm but also the regular stdin one.

Hopefully I'm doing something wrong.


regards

_______________________________________________
Bug-ncurses mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/bug-ncurses




reply via email to

[Prev in Thread] Current Thread [Next in Thread]