commit 9cf15e55c971ed2f702681d6c1617422928e133b Author: sigonasr2, Sig, Sigo Date: Fri Apr 29 19:16:35 2022 +0000 Setup a listening IRC client that connects using TCP sockets. diff --git a/clean b/clean new file mode 100755 index 0000000..c12f537 --- /dev/null +++ b/clean @@ -0,0 +1,2 @@ +cd /workspace/sigIRC +find . -type f -name *.class -delete \ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..c1370c4 --- /dev/null +++ b/readme.md @@ -0,0 +1 @@ +Use https://datatracker.ietf.org/doc/html/rfc1459 as a reference for building an IRC client. \ No newline at end of file diff --git a/run b/run new file mode 100755 index 0000000..1347630 --- /dev/null +++ b/run @@ -0,0 +1,5 @@ +cd /workspace/sigIRC +javac -Xlint:unchecked -cp . sigIRC.java +printf "\n\n\nRunning Program...\n\n" +java sigIRC +./clean \ No newline at end of file diff --git a/sigIRC.java b/sigIRC.java new file mode 100644 index 0000000..d326063 --- /dev/null +++ b/sigIRC.java @@ -0,0 +1,29 @@ +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.net.Socket; + +public class sigIRC{ + static Socket socket; + static PrintWriter out; + static BufferedReader in; + public static void main(String[] args) { + try { + socket = new Socket("projectdivar.com",6667); + out = new PrintWriter(socket.getOutputStream(),true); + in=new BufferedReader(new InputStreamReader(socket.getInputStream())); + out.println("NICK sigonasr2"); + out.println("USER sigonasr2 localhost localhost Sig"); + while (true) { + String line; + if ((line=in.readLine())!=null) { + System.out.println(line); + } + } + } catch (IOException e) { + e.printStackTrace(); + } + + } +} \ No newline at end of file