diff --git a/.gitignore b/.gitignore
index 53d2375..237cb8c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,5 @@
/pitiupi.chat/nbproject/private/
/pitiupi.screenCast/build/
/pitiupi.screenCast/dist/
+
+.idea/
diff --git a/pitiupi.chat/build/built-jar.properties b/pitiupi.chat/build/built-jar.properties
index 4683cca..ab84885 100644
--- a/pitiupi.chat/build/built-jar.properties
+++ b/pitiupi.chat/build/built-jar.properties
@@ -1,4 +1,4 @@
-#Sat, 18 Jul 2026 10:32:46 -0300
+#Mon, 17 Aug 2026 14:26:26 -0300
C\:\\Users\\extre\\OneDrive\\Documentos\\Faculdade\\2026_02\\Monitoria\\Pitiupi\\pitiupi.chat=
diff --git a/pitiupi.chat/build/classes/pitiupi/chat/GUI/ChatWindow.class b/pitiupi.chat/build/classes/pitiupi/chat/GUI/ChatWindow.class
index 4d4bde2..15ff534 100644
Binary files a/pitiupi.chat/build/classes/pitiupi/chat/GUI/ChatWindow.class and b/pitiupi.chat/build/classes/pitiupi/chat/GUI/ChatWindow.class differ
diff --git a/pitiupi.chat/pitiupi.chat.iml b/pitiupi.chat/pitiupi.chat.iml
index c90834f..4e2cbb3 100644
--- a/pitiupi.chat/pitiupi.chat.iml
+++ b/pitiupi.chat/pitiupi.chat.iml
@@ -7,5 +7,14 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pitiupi.chat/src/pitiupi/chat/GUI/ChatWindow.java b/pitiupi.chat/src/pitiupi/chat/GUI/ChatWindow.java
index 3b707fa..c963334 100644
--- a/pitiupi.chat/src/pitiupi/chat/GUI/ChatWindow.java
+++ b/pitiupi.chat/src/pitiupi/chat/GUI/ChatWindow.java
@@ -91,7 +91,7 @@ public class ChatWindow extends javax.swing.JDialog {
}
private void sendMessage() {
- if (jTextArea1.getText().trim().length() == 0) {
+ if (jTextArea1.getText().trim().isEmpty()) {
return;
}
ChatMessage message = new ChatMessage(mainWindow.getUserName(), jTextArea1.getText());
@@ -101,7 +101,7 @@ public class ChatWindow extends javax.swing.JDialog {
public void sendChatMessage(Message message) {
try {
- mainWindow.getSocket().send(message.toByteArray());
+ mainWindow.getSocketUDP().sendMulticast(message.toByteArray());
} catch (IOException ex) {
Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
}
diff --git a/pitiupi.screenCast/.idea/ant.xml b/pitiupi.screenCast/.idea/ant.xml
new file mode 100644
index 0000000..a2a4769
--- /dev/null
+++ b/pitiupi.screenCast/.idea/ant.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pitiupi.screenCast/.idea/misc.xml b/pitiupi.screenCast/.idea/misc.xml
new file mode 100644
index 0000000..59ad060
--- /dev/null
+++ b/pitiupi.screenCast/.idea/misc.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/pitiupi.screenCast/.idea/vcs.xml b/pitiupi.screenCast/.idea/vcs.xml
new file mode 100644
index 0000000..6c0b863
--- /dev/null
+++ b/pitiupi.screenCast/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pitiupi.screenCast/.idea/workspace.xml b/pitiupi.screenCast/.idea/workspace.xml
index 96dbbb3..61262cc 100644
--- a/pitiupi.screenCast/.idea/workspace.xml
+++ b/pitiupi.screenCast/.idea/workspace.xml
@@ -5,14 +5,24 @@
-
-
-
-
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -22,9 +32,9 @@
-
+ {
+ "associatedIndex": 7
+}
@@ -34,13 +44,65 @@
"keyToString": {
"ModuleVcsDetector.initialDetectionPerformed": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
+ "RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true",
"RunOnceActivity.git.unshallow": "true",
- "git-widget-placeholder": "QuizPlugin",
+ "git-widget-placeholder": "feature/unicast",
+ "ignore.virus.scanning.warn.message": "true",
"kotlin-language-version-configured": "true",
"last_opened_file_path": "C:/Users/extre/OneDrive/Documentos/Faculdade/2026_02/Monitoria/Pitiupi/pitiupi.screenCast",
+ "project.structure.last.edited": "Modules",
+ "project.structure.proportion": "0.15",
+ "project.structure.side.proportion": "0.2",
"settings.editor.selected.configurable": "preferences.keymap"
}
}]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pitiupi.screenCast/build/built-jar.properties b/pitiupi.screenCast/build/built-jar.properties
index 771342c..c3e64e2 100644
--- a/pitiupi.screenCast/build/built-jar.properties
+++ b/pitiupi.screenCast/build/built-jar.properties
@@ -1,4 +1,4 @@
-#Sat, 18 Jul 2026 10:33:07 -0300
+#Mon, 17 Aug 2026 14:35:40 -0300
C\:\\Users\\extre\\OneDrive\\Documentos\\Faculdade\\2026_02\\Monitoria\\Pitiupi\\pitiupi.screenCast=
diff --git a/pitiupi.screenCast/build/classes/pitiupi/screenCast/GUI/ScreenCastWindow.class b/pitiupi.screenCast/build/classes/pitiupi/screenCast/GUI/ScreenCastWindow.class
index 490ff3f..285c323 100644
Binary files a/pitiupi.screenCast/build/classes/pitiupi/screenCast/GUI/ScreenCastWindow.class and b/pitiupi.screenCast/build/classes/pitiupi/screenCast/GUI/ScreenCastWindow.class differ
diff --git a/pitiupi.screenCast/src/pitiupi/screenCast/GUI/ScreenCastWindow.java b/pitiupi.screenCast/src/pitiupi/screenCast/GUI/ScreenCastWindow.java
index f3ae1ca..399f15a 100644
--- a/pitiupi.screenCast/src/pitiupi/screenCast/GUI/ScreenCastWindow.java
+++ b/pitiupi.screenCast/src/pitiupi/screenCast/GUI/ScreenCastWindow.java
@@ -98,7 +98,7 @@ public class ScreenCastWindow extends javax.swing.JFrame {
}
if (msg != null) {
try {
- this.mainWindow.getSocket().send(msg);
+ this.mainWindow.getSocketUDP().sendMulticast(msg);
} catch (IOException ex) {
System.out.println(ex.toString());
this.compressRatio -= 0.1f;
diff --git a/pitiupi.testSocket/out/GUI/SocketTestMenu.class b/pitiupi.testSocket/out/GUI/SocketTestMenu.class
new file mode 100644
index 0000000..19be548
Binary files /dev/null and b/pitiupi.testSocket/out/GUI/SocketTestMenu.class differ
diff --git a/pitiupi.testSocket/out/GUI/SocketTestWindow.class b/pitiupi.testSocket/out/GUI/SocketTestWindow.class
new file mode 100644
index 0000000..475d4ad
Binary files /dev/null and b/pitiupi.testSocket/out/GUI/SocketTestWindow.class differ
diff --git a/pitiupi.testSocket/out/META-INF/services/pitiupi.plugin.Plugin b/pitiupi.testSocket/out/META-INF/services/pitiupi.plugin.Plugin
new file mode 100644
index 0000000..cdf4196
--- /dev/null
+++ b/pitiupi.testSocket/out/META-INF/services/pitiupi.plugin.Plugin
@@ -0,0 +1 @@
+plugin.SocketTest
diff --git a/pitiupi.testSocket/out/net/TestMessage.class b/pitiupi.testSocket/out/net/TestMessage.class
new file mode 100644
index 0000000..d472376
Binary files /dev/null and b/pitiupi.testSocket/out/net/TestMessage.class differ
diff --git a/pitiupi.testSocket/out/plugin/SocketTest.class b/pitiupi.testSocket/out/plugin/SocketTest.class
new file mode 100644
index 0000000..a984f73
Binary files /dev/null and b/pitiupi.testSocket/out/plugin/SocketTest.class differ
diff --git a/pitiupi.testSocket/src/GUI/SocketTestMenu.java b/pitiupi.testSocket/src/GUI/SocketTestMenu.java
new file mode 100644
index 0000000..8b4984f
--- /dev/null
+++ b/pitiupi.testSocket/src/GUI/SocketTestMenu.java
@@ -0,0 +1,21 @@
+package GUI;
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+
+public class SocketTestMenu extends JMenu {
+ private final SocketTestWindow socketTestWindow;
+
+ public SocketTestMenu(SocketTestWindow socketTestWindow) {
+ this.socketTestWindow = socketTestWindow;
+ this.setText("Chat");
+ JMenuItem menuItem = new JMenuItem();
+ menuItem.setText("Show Chat Window");
+ menuItem.addActionListener(this::showTestWindow);
+ this.add(menuItem);
+ }
+
+ private void showTestWindow(ActionEvent ae) {
+ this.socketTestWindow.setVisible(true);
+ }
+}
diff --git a/pitiupi.testSocket/src/GUI/SocketTestWindow.java b/pitiupi.testSocket/src/GUI/SocketTestWindow.java
new file mode 100644
index 0000000..32f3944
--- /dev/null
+++ b/pitiupi.testSocket/src/GUI/SocketTestWindow.java
@@ -0,0 +1,151 @@
+package GUI;
+
+import net.TestMessage;
+import pitiupi.GUI.MainWindow;
+
+import javax.swing.*;
+import java.awt.*;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class SocketTestWindow extends JFrame {
+ private MainWindow mainWindow;
+ private JTextArea receivedMessagesArea;
+
+ private JTextField ipField;
+ private JTextField messageField;
+
+ private JButton tcpButton;
+ private JButton udpButton;
+ private JButton multicastButton;
+
+ public SocketTestWindow(MainWindow mainWindow) {
+ this.mainWindow = mainWindow;
+ initComponents();
+ }
+
+ public void initComponents() {
+ setTitle("Socket Test");
+ setSize(700, 500);
+ setLocationRelativeTo(null);
+ setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
+
+ JPanel mainPanel = new JPanel(new BorderLayout(10, 10));
+
+ mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+
+ initReceivedMessagesPanel(mainPanel);
+ initBottomPanel(mainPanel);
+
+ setContentPane(mainPanel);
+ }
+
+ private void initReceivedMessagesPanel(JPanel mainPanel) {
+ receivedMessagesArea = new JTextArea();
+ receivedMessagesArea.setEditable(false);
+ receivedMessagesArea.setLineWrap(true);
+ receivedMessagesArea.setWrapStyleWord(true);
+
+ JScrollPane messagesScrollPane = new JScrollPane(receivedMessagesArea);
+
+ messagesScrollPane.setBorder(BorderFactory.createTitledBorder("Mensagens recebidas"));
+
+ mainPanel.add(messagesScrollPane, BorderLayout.CENTER);
+ }
+
+ private void initBottomPanel(JPanel mainPanel) {
+ ipField = new JTextField();
+ ipField.setPreferredSize(new Dimension(130, 30));
+
+ JPanel ipPanel = new JPanel(new BorderLayout(5, 5));
+ ipPanel.add(new JLabel("IP destino:"), BorderLayout.WEST);
+ ipPanel.add(ipField, BorderLayout.CENTER);
+
+ messageField = new JTextField();
+
+ JPanel bottomPanel = new JPanel(new BorderLayout(10, 10));
+
+ bottomPanel.add(ipPanel, BorderLayout.WEST);
+ bottomPanel.add(messageField, BorderLayout.CENTER);
+ initButtons(bottomPanel);
+
+ mainPanel.add(bottomPanel, BorderLayout.SOUTH);
+ }
+
+ private void initButtons(JPanel bottomPanel) {
+ tcpButton = new JButton("TCP");
+ udpButton = new JButton("UDP");
+ multicastButton = new JButton("Multicast");
+
+ tcpButton.addActionListener(e -> sendTCP());
+ udpButton.addActionListener(e -> sendUDP());
+ multicastButton.addActionListener(e -> sendMulticast());
+
+ JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 0));
+
+ buttonsPanel.add(tcpButton);
+ buttonsPanel.add(udpButton);
+ buttonsPanel.add(multicastButton);
+
+ bottomPanel.add(buttonsPanel, BorderLayout.EAST);
+ }
+
+ public void sendTCP() {
+ try {
+ TestMessage msg = createMessage("TCP Unicast");
+ InetAddress ip = InetAddress.getByName(ipField.getText());
+ mainWindow.getSocketTCP().send(msg.toByteArray(), ip);
+ } catch (Exception ex) {
+ Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
+ }
+
+ }
+ public void sendUDP() {
+ try {
+ TestMessage msg = createMessage("UDP Unicast");
+ InetAddress ip = InetAddress.getByName(ipField.getText());
+ mainWindow.getSocketUDP().sendUnicast(msg.toByteArray(), ip);
+ } catch (Exception ex) {
+ Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+ public void sendMulticast() {
+ try {
+ TestMessage msg = createMessage("UDP Multicast");
+ mainWindow.getSocketUDP().sendMulticast(msg.toByteArray());
+ } catch (Exception ex) {
+ Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+
+ private TestMessage createMessage(String tipoMensagem) {
+ try {
+ String nome = mainWindow.getUserName();
+ String ip = InetAddress.getLocalHost().getHostAddress();
+ String message = messageField.getText();
+ return new TestMessage(nome, ip, tipoMensagem, message);
+ } catch (UnknownHostException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void receiveMessage(TestMessage msg) {
+ SwingUtilities.invokeLater(() -> {
+ String mensagem = String.format(
+ "[%s] %s (%s): %s%n",
+ msg.getTipoMensagem(),
+ msg.getNome(),
+ msg.getIp(),
+ msg.getMessage()
+ );
+
+ receivedMessagesArea.append(mensagem);
+
+ receivedMessagesArea.setCaretPosition(
+ receivedMessagesArea.getDocument().getLength()
+ );
+ });
+ }
+}
diff --git a/pitiupi.testSocket/src/META-INF/services/pitiupi.plugin.Plugin b/pitiupi.testSocket/src/META-INF/services/pitiupi.plugin.Plugin
new file mode 100644
index 0000000..cdf4196
--- /dev/null
+++ b/pitiupi.testSocket/src/META-INF/services/pitiupi.plugin.Plugin
@@ -0,0 +1 @@
+plugin.SocketTest
diff --git a/pitiupi.testSocket/src/net/TestMessage.java b/pitiupi.testSocket/src/net/TestMessage.java
new file mode 100644
index 0000000..cb947d4
--- /dev/null
+++ b/pitiupi.testSocket/src/net/TestMessage.java
@@ -0,0 +1,35 @@
+package net;
+
+import pitiupi.net.Message;
+
+public class TestMessage extends Message {
+ private String nome;
+ private String ip;
+ private String tipoMensagem;
+ private String message;
+
+ public TestMessage(String nome, String ip, String tipoMensagem, String message) {
+ this.nome = nome;
+ this.ip = ip;
+ this.tipoMensagem = tipoMensagem;
+ this.message = message;
+ }
+
+ public TestMessage(){}
+
+ public String getNome() {
+ return nome;
+ }
+
+ public String getIp() {
+ return ip;
+ }
+
+ public String getTipoMensagem() {
+ return tipoMensagem;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+}
diff --git a/pitiupi.testSocket/src/plugin/SocketTest.java b/pitiupi.testSocket/src/plugin/SocketTest.java
new file mode 100644
index 0000000..66ef6f0
--- /dev/null
+++ b/pitiupi.testSocket/src/plugin/SocketTest.java
@@ -0,0 +1,56 @@
+package plugin;
+
+import GUI.SocketTestMenu;
+import GUI.SocketTestWindow;
+import net.TestMessage;
+import pitiupi.GUI.MainWindow;
+import pitiupi.net.Message;
+import pitiupi.plugin.Plugin;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+
+public class SocketTest implements Plugin{
+ SocketTestWindow socketTestWindow;
+
+ @Override
+ public String getName() {
+ return "Test Socket";
+ }
+
+ @Override
+ public String getAuthor() {
+ return "Gustavo Henrique";
+ }
+
+ @Override
+ public String getVersion() {
+ return "0";
+ }
+
+ @Override
+ public void createPlugin(MainWindow mainWindow) {
+ this.socketTestWindow = new SocketTestWindow(mainWindow);
+ mainWindow.addMenu(new SocketTestMenu(socketTestWindow));
+ }
+
+ @Override
+ public Message getMessage() {
+ return new TestMessage();
+ }
+
+ @Override
+ public void receiveMessage(byte[] bytes) {
+ ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
+ ObjectInputStream ois;
+ try {
+ ois = new ObjectInputStream(bis);
+ if (ois.readObject() instanceof TestMessage msg) {
+ this.socketTestWindow.receiveMessage(msg);
+ }
+ } catch (IOException | ClassNotFoundException ex) {
+ System.out.println(ex.toString());
+ }
+ }
+}
diff --git a/pitiupi/.gitignore b/pitiupi/.gitignore
index 7530920..31f5f52 100644
--- a/pitiupi/.gitignore
+++ b/pitiupi/.gitignore
@@ -8,3 +8,5 @@
# JARs gerados
*.jar
+
+.idea/
diff --git a/pitiupi/src/pitiupi/GUI/MainWindow.java b/pitiupi/src/pitiupi/GUI/MainWindow.java
index e3f4ffd..3f40ab9 100644
--- a/pitiupi/src/pitiupi/GUI/MainWindow.java
+++ b/pitiupi/src/pitiupi/GUI/MainWindow.java
@@ -135,10 +135,14 @@ public class MainWindow extends javax.swing.JFrame {
return this.port;
}
- public SocketUDP getSocket() {
+ public SocketUDP getSocketUDP() {
return this.socketUDP;
}
+ public SocketTCP getSocketTCP() {
+ return this.socketTCP;
+ }
+
public List getPlugins() {
return plugins;
}
diff --git a/pitiupi/src/pitiupi/control/HeartbeatManager.java b/pitiupi/src/pitiupi/control/HeartbeatManager.java
index 6fb380e..1cfa480 100644
--- a/pitiupi/src/pitiupi/control/HeartbeatManager.java
+++ b/pitiupi/src/pitiupi/control/HeartbeatManager.java
@@ -66,7 +66,7 @@ public class HeartbeatManager {
private void announce() {
try {
HeartbeatMessage msg = new HeartbeatMessage(mainWindow.getUserName(), instanceId);
- mainWindow.getSocket().sendMulticast(msg.toByteArray());
+ mainWindow.getSocketUDP().sendMulticast(msg.toByteArray());
} catch (IOException ex) {
Logger.getLogger(HeartbeatManager.class.getName()).log(Level.WARNING, "Falha ao enviar heartbeat", ex);
}