Net::TCP::PtyServer

Net::TCP::PtyServer is a Perl module that serves pseudo-terminals.
Download

Net::TCP::PtyServer Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Net::TCP::PtyServer team
  • Publisher web site:
  • http://search.cpan.org/~rjlee/Net-TCP-PtyServer-1/lib/Net/TCP/PtyServer.pm

Net::TCP::PtyServer Tags


Net::TCP::PtyServer Description

Net::TCP::PtyServer is a Perl module that serves pseudo-terminals. Net::TCP::PtyServer is a Perl module that serves pseudo-terminals.Opens a listening connection on a port, waits for network connections on that port, and serves each one in a seperate PTY.Coping with terminal size changesTo set the size of a terminal, you need to call ioctl(), and pass the pseudo-TTY handle, the constant TIOCSWINSZ (defined in termio.h or termios.h - or on my system, defined in the asm includes and imported by one of them), and a winsize{} C-structure.The TIOCGWINSZ (G instead of S) can also be used to get the size of a terminal. This is used to generate the structure passed to ioctl in the case of the pseudo-TTY running on a real terminal; see this code from IOS::TTY (referenced by IOS::PTY): sub clone_winsize_from { my ($self, $fh) = @_; my $winsize = ""; croak "Given filehandle is not a tty in clone_winsize_from, called" if not POSIX::isatty($fh); return 1 if not POSIX::isatty($self); # ignored for master ptys ioctl($fh, &IO::Tty::Constant::TIOCGWINSZ, $winsize) and ioctl($self, &IO::Tty::Constant::TIOCSWINSZ, $winsize) and return 1; warn "clone_winsize_from: error: $!" if $^W; return undef; }The structrure of winsize is defined in termios.h as follows: struct winsize { unsigned short ws_row; unsigned short ws_col; unsigned short ws_xpixel; unsigned short ws_ypixel; };And the Internet tells me that ws_row is the number of rows, ws_col the number of columns, ws_xpixel the number of horizontal pixels across the terminal, and ws_ypixel the number of vertical pixels across the terminal.After a little experiementing, this seems to work to create the struct, although it should be noted that this assumes that the struct has the same memory alignment as an array of unsigned shorts: my $winsize = pack("S*",$ws_row,$ws_col,$ws_xpixel,$ws_ypixel);So that's what I'm trying to use (thus saving an XS C function) Requirements: · Perl


Net::TCP::PtyServer Related Software