Implementation of Telnet Server in java Code
Implementation of a telnet server in java using knock knock jokes.
Status: Beta
Brought to you by:
shubhdarlinge
File | Date | Author | Commit |
---|---|---|---|
build | 2015-05-19 |
![]() |
[6675c3] Initial commit |
nbproject | 2015-05-19 |
![]() |
[6675c3] Initial commit |
src | 2015-05-19 |
![]() |
[6675c3] Initial commit |
README.txt | 2015-05-19 |
![]() |
[6675c3] Initial commit |
build.xml | 2015-05-19 |
![]() |
[6675c3] Initial commit |
knock-knock-jokes | 2015-05-19 |
![]() |
[6675c3] Initial commit |
manifest.mf | 2015-05-19 |
![]() |
[6675c3] Initial commit |
Telnet KnockKnock Server (version-1.0) ------------------------------------------------------ Developer: Shubham Darlinge (shubh.darlinge@gmail.com) Project base language: JAVA ## Requirements: * A machine that could act as a server machine for deploying server application. * Java (JRE - www.java.com) * JDK (for compiling only) ## Compilation: This project was built in NetBeans on jdk-1.8.0_45. To compile it, import the telnet-knock-knock-server-netbeans.zip file into NetBeans and press F6, or, extract all the contents from src.zip into a folder and using the folder as base directory, compile the file "TelnetKnockKnockServer.java" using javac binary in the JDK. ## Deploying the server: Compile the source in to binaries or use the provided bin.zip for running the TelnetKnockKnockServer.class file using following command: > java TelnetKnockKnockServer to run the serven in default configuration. It does not show/log any information in the default mode. The default server port is 23. The complete modes of operation and usage information is as shown below: Telnet KnockKnock Server (version-1.0) Usage: java TelnetKnockKnockServer [-p | --port PORT_NUMBER] [-l | --log [-f | --logfile LOG_FILE_NAME]] [-o | --output] [-? | --help] -p, --port Specify the port number (default is 23) -o, --output Output information on screen -l, --log Output information to log file -f, --logfile Specify the log file name (default is telnet-log.log) -?, --help Display this help message Using this command the server application can be deployed on a server machine and can be accessed from over the internet. ## Accessing the server using a Telnet client: Using telnet clients available on almost every operating system, the server can be accessed and used. For example, to access the server running on a machine having an arbitary ip address xx.xx.xx.xx, this server can be a accessed from a Windows platform using the command: > telnet xx.xx.xx.xx if the server is running on default port 23. If the port is explicitly specified while executing server (say 3999), then the command is modified as: > telnet xx.xx.xx.xx 3999 ## Testing the server locally: You can test it in the a local network as follows: 1. Keep two machines connected in a local area network. (Let ip address of machine #1, the server machine, to be 192.168.1.1) 2. Run the server in machine #1 using following command: > java TelnetKnockKnockServer -o -l 3. Open up a terminal or command prompt on machine #2. 4. Type and run the following command: > telnet 192.168.1.1 5. Respond to the server from the client and connecting will be automatically closed at the end of conversation. ## Notes * Some operating systems may block this command from executing because of permission issues. In such case, make sure that the operating system allows this application to use the port 23 by providing administrative privileges or specify another port using -p (e.g. -p 3999). While using another port (say 3999), the command in step 2 is modified as: > java TelnetKnockKnockServer -o -l -p 3999 and that in step 4 is modified as: > telnet 192.168.1.1 3999 * If another machine is not available, the server can be accessed from same machine and another terminal or command prompt by modifying command in step 4 as: > telnet 127.0.0.1 or > telnet 127.0.0.1 3999 * While running the server, make sure that the "knock-knock-jokes" file is placed in the base directory as it uses the file as jokes database. Another option is to explicitly specify the file directory and name using the -f or --logfile switch.