Nicholas Reid

Greenhorn
+ Follow
since Oct 09, 2021
Nicholas likes ...
Python MySQL Database Java
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nicholas Reid

Carey Brown wrote:readLine() is expecting a "\n", are you sure the server is sending that? Is server flushing the output buffer?

The incoming.append() call is on a different thread than the EDT, you'll need an invokeLater().

I would put more println()'s in IncomingReader to let me know if readLine() returned null, for instance.



Is readLine() expecting a "\n"? The functionality expressed there is meant to print the message to the JTextArea 'incoming', then make a new line, for another message.

The server seems to work fine, see here:



I've put print statements, and it seems to get the message. And writer.println(message) should send it to IncomingReader, no? That having been said, it does actually run the IncomingReader try-catch block but seems to have a problem actually appending the JTextArea. Is this because of me using a separate thread?

Regardless, I have tried giving the server input, and retrieving output via a program without the GUI, and the same problem occurs.
1 week ago

Carey Brown wrote:readLine() is expecting a "\n", are you sure the server is sending that? Is server flushing the output buffer?

The incoming.append() call is on a different thread than the EDT, you'll need an invokeLater().

I would put more println()'s in IncomingReader to let me know if readLine() returned null, for instance.



Is readLine() expecting a "\n"? The functionality expressed there is meant to print the message to the JTextArea 'incoming', then make a new line, for another message.

The server seems to work fine, see here:



I've put print statements, and it seems to get the message. And writer.println(message) should send it to IncomingReader, no? That having been said, I really can't get it to run the try-catch statement. I don't know if there's something wrong with my conditions?

Regardless, I have tried giving the server input, and retrieving output via a program without the GUI, and there still seems to be an issue with retrieval of the message.
1 week ago
IncomingReader is called before the Swing code, please see [1]. It's called after setUpNetworking(), before JScrollPane etc.

I couldn't post the entire code here, and I'm not super sure how to get it working without the GUI.
1 week ago
Hello! Apologies, I will in the future.

Yes, that's right. I have slightly forked it. My goal is to take in the JTextField input, send that to the server, and then have the server put the retrieved text as a message in the JTextArea called 'incoming'. The issue is with the text not appearing within JTextArea, as the IncomingReader seems to not pass the try-catch statement.

I have several Sout statements both in the posted code, and the server. Which confirms the message is being sent to the server, but does not print 'read: 'message''. this would indicate there's something wrong with the IncomingReader code.
1 week ago
Hey guys, first post here.

I have an issue wherein I cannot pass information from a server socket to a JTextArea - and cannot for the life of me figure out why.

The program sends user input to the server, the server receives (indicated via print for testing purposes), and then... nothing.

Sorry regarding the verbosity, but it's a GUI program and I think it helps elucidate the problem. See [1] for full code.



[1] https://github.com/nreid2946/BeatBox_WithClient
1 week ago