Skip to content
Snippets Groups Projects
Commit 80db02fd authored by Timberlake, James (Jack) (LT)'s avatar Timberlake, James (Jack) (LT)
Browse files

HW1 javadoc

parent 64a7249d
No related branches found
No related tags found
No related merge requests found
...@@ -6,10 +6,56 @@ import java.net.InetAddress; ...@@ -6,10 +6,56 @@ import java.net.InetAddress;
import java.util.Scanner; import java.util.Scanner;
/** /**
* * <p>
* @author Jack * The simplest TCP network program, opening a socket between a client and server
* and send a message from the client to the server.
* It listens for any socket connection response, either from telnet (telnet localhost 2317)
* or another client program.
* Once a socket connection is established, the client sends messages to the
* server and the server echos the message back to the client.
*
* <p>
* As an alternative to running the Windows (or other operating system) console,
* you can instead run the NetBeans terminal window. If you are on Windows,
* NetBeans is looking for Cygwin installation (for Unix-like compatibility)
* with details at <a href="https://savage.nps.edu/Savage/developers.html#Cygwin" target="blank">Savage Developers Guide: Cygwin</a>.
* Modifying this program is the basis for Assignment 1.
* </p>
* <p>
* Notice that "Client Received" matches
* what is written by the code below, over the output stream.
* </p>
* * <p>
* Notice that "Server Received" matches the string sent by the client.
* </p>
* <p>
* After the echoed message is received by the client, the program exits.
* For example:
* Enter message to send to server: hello
* Client received: Hello From Server, I received: hello
* [Program Exits]
* </p>
*
* @see <a href="../../../src/TcpExamples/TcpExample1TerminalLog.txt" target="_blank">TcpExample1TerminalLog.txt</a>
* @see <a href="../../../src/TcpExamples/TcpExample1NetBeansConsoleTelnet.png" target="_blank">TcpExample1NetBeansConsoleTelnet.png</a>
* @see <a href="../../../src/TcpExamples/TcpExample1NetBeansConsoleTelnet.pdf" target="_blank">TcpExample1NetBeansConsoleTelnet.pdf</a>
* @see <a href="../../../src/TcpExamples/TcpExample1ScreenshotNetcat.png" target="_blank">TcpExample1ScreenshotNetcat.png</a>
* @see <a href="../../../src/TcpExamples/TcpExample1ScreenshotTelnet.png" target="_blank">TcpExample1ScreenshotTelnet.png</a>
* @see <a href="https://savage.nps.edu/Savage/developers.html#Cygwin" target="blank">Savage Developers Guide: Cygwin</a>
* @see <a href="https://savage.nps.edu/Savage/developers.html#telnet" target="blank">Savage Developers Guide: telnet</a>
*
* @author mcgredo
* @author brutzman@nps.edu
* @author james.timberlake@nps.edu
*/ */
public class Client { public class Client {
/**
* Default constructor
* Program invocation, execution starts here
* @param args command-line arguments
*/
public static void main(String[] args) { public static void main(String[] args) {
DatagramSocket socket = null; DatagramSocket socket = null;
Scanner scanner = new Scanner(System.in); Scanner scanner = new Scanner(System.in);
......
...@@ -5,10 +5,56 @@ import java.net.DatagramSocket; ...@@ -5,10 +5,56 @@ import java.net.DatagramSocket;
import java.net.InetAddress; import java.net.InetAddress;
/** /**
* * <p>
* @author Jack * The simplest TCP network program, opening a socket between a client and server
* and send a message from the client to the server.
* It listens for any socket connection response, either from telnet (telnet localhost 2317)
* or another client program.
* Once a socket connection is established, the client sends messages to the
* server and the server echos the message back to the client.
*
* <p>
* As an alternative to running the Windows (or other operating system) console,
* you can instead run the NetBeans terminal window. If you are on Windows,
* NetBeans is looking for Cygwin installation (for Unix-like compatibility)
* with details at <a href="https://savage.nps.edu/Savage/developers.html#Cygwin" target="blank">Savage Developers Guide: Cygwin</a>.
* Modifying this program is the basis for Assignment 1.
* </p>
* <p>
* Notice that "Client Received" matches
* what is written by the code below, over the output stream.
* </p>
* * <p>
* Notice that "Server Received" matches the string sent by the client.
* </p>
* <p>
* After the echoed message is received by the client, the program exits.
* For example:
* Enter message to send to server: hello
* Client received: Hello From Server, I received: hello
* [Program Exits]
* </p>
*
* @see <a href="../../../src/TcpExamples/TcpExample1TerminalLog.txt" target="_blank">TcpExample1TerminalLog.txt</a>
* @see <a href="../../../src/TcpExamples/TcpExample1NetBeansConsoleTelnet.png" target="_blank">TcpExample1NetBeansConsoleTelnet.png</a>
* @see <a href="../../../src/TcpExamples/TcpExample1NetBeansConsoleTelnet.pdf" target="_blank">TcpExample1NetBeansConsoleTelnet.pdf</a>
* @see <a href="../../../src/TcpExamples/TcpExample1ScreenshotNetcat.png" target="_blank">TcpExample1ScreenshotNetcat.png</a>
* @see <a href="../../../src/TcpExamples/TcpExample1ScreenshotTelnet.png" target="_blank">TcpExample1ScreenshotTelnet.png</a>
* @see <a href="https://savage.nps.edu/Savage/developers.html#Cygwin" target="blank">Savage Developers Guide: Cygwin</a>
* @see <a href="https://savage.nps.edu/Savage/developers.html#telnet" target="blank">Savage Developers Guide: telnet</a>
*
* @author mcgredo
* @author brutzman@nps.edu
* @author james.timberlake@nps.edu
*/ */
public class Server { public class Server {
/**
* Default constructor
* Program invocation, execution starts here
* @param args none
*/
public static void main(String[] args) { public static void main(String[] args) {
DatagramSocket socket = null; DatagramSocket socket = null;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment