Code Monkey home page Code Monkey logo

nvt4j's Introduction

About

The Network Virtual Terminal for Java (NVT4J) is a library which can drive a terminal emulator connected to the application through a telnet session.

Current Status

This project was imported as an abandonded orphan from Google Code and given a new home here on Github on 17-Nov-2015.

Usage

The API consists of the interface Terminal. The implementation of this class is called TerminalImpl. To allow the user to connect to the application you need to listen for a tcp connection and then wrap a TerminalImpl object around it:

ServerSocket serverSocket = new ServerSocket(8000);
Socket socket = serverSocket.accept();
Terminal terminal = new TerminalImpl(socket);

For example, to run the sample class Example.java from an xterm session, you can do this:

user@localhost$ java -classpath nvt4j.jar Example &
user@localhost$ telnet localhost 8000

NVT4J uses the Telnet LINEMODE option to put the terminal driver (xterm in this case) in what the posix standard calls 'raw' or 'non-canonical' mode, so that it can receive all user inputs asap, instead of waiting for a new-line character.

Unfortunately in pure Java there is no way to put the operating system console in raw mode. On Linux and similar systems this is done using the stty command, which is a native program which manipulates the terminal driver in the operating system.

Downloads

See Downloads.

Documentation

View the Javadoc API.

License

See the LICENSE file.

Copyright 2006 Guglielmo Lichtner

Copyright 2015 Archie L. Cobbs

nvt4j's People

Contributors

archiecobbs avatar

Stargazers

 avatar  avatar Kevin Hatfield avatar

Watchers

 avatar James Cloos avatar  avatar

nvt4j's Issues

Terminal init enters infinite loop if a client disconnects before negotiating all options

What steps will reproduce the problem?
1. connect as a client
2. do not send any option negotiation commands, DO send enough bytes to fill 
the decode buffer in the TelnetInputStream
3. disconnect
Run attached code to reproduce.

What is the expected output? What do you see instead?
Expected output is everything returns to normal. What I see is the thread that 
constructs the Terminal is stuck in a loop in the init method and using up to 
100% CPU

What version of the product are you using? On what operating system?
Bug tested on Mac OS

Please provide any additional information below.
Checking that the input stream has not reached the end in the init loop will 
prevent this from happening. See fix.diff for the small change to 
nvt4j.impl.Terminal.java

Original issue reported on code.google.com by [email protected] on 27 Sep 2010 at 7:22

Attachments:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.