From b4dbd2cfa724476162fa6d35941a5d7cdc9c9524 Mon Sep 17 00:00:00 2001 From: Tucker Evans Date: Mon, 18 Feb 2019 08:10:10 -0500 Subject: Adds all assignments not previously in a git repo --- CS2452/assign5/src/Client.java | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 CS2452/assign5/src/Client.java (limited to 'CS2452/assign5/src/Client.java') diff --git a/CS2452/assign5/src/Client.java b/CS2452/assign5/src/Client.java new file mode 100755 index 0000000..9d7cb19 --- /dev/null +++ b/CS2452/assign5/src/Client.java @@ -0,0 +1,32 @@ +import java.net.*; +import java.io.*; + +class Client +{ + public static void main(String[] args) + { + try + { + byte b = 0; + int cnt = 0; + Socket s = new Socket(args[0], Integer.parseInt(args[1])); + DataInputStream di = new DataInputStream(s.getInputStream()); + while (true) + { + b = di.readByte(); + System.out.printf("%d - %d\t%x\t%c\n", ++cnt, b, b, b); + if ((cnt % (1024 * 1024)) == 0) + { + System.out.println("------MILLION------\n\n"); + cnt = 0; + Thread.sleep(1000); + di.close(); + return; + } + } + } catch (Exception e) + { + e.printStackTrace(); + } + } +} \ No newline at end of file -- cgit v1.1