Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/ChatProgram.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import io.github.pixee.security.BoundedLineReader;
import java.io.*;
import java.net.*;
import java.util.Scanner;
Expand Down Expand Up @@ -43,7 +44,7 @@ public void run() {
PrintWriter out = new PrintWriter(socket.getOutputStream(), true);

String input;
while ((input = keyboardReader.readLine()) != null) {
while ((input = BoundedLineReader.readLine(keyboardReader, 5_000_000)) != null) {
out.println(input);

// If the message is "transfer filename", transfer the file
Expand Down Expand Up @@ -97,7 +98,7 @@ public void run() {
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));

String message;
while ((message = in.readLine()) != null) {
while ((message = BoundedLineReader.readLine(in, 5_000_000)) != null) {
System.out.println("Received: " + message);

// If the message is "transfer filename", receive the file
Expand Down