![]() |
|
eChat App w/ server 2.0 - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Java, JVM, & JRE (https://sinister.li/Forum-Java-JVM-JRE) +--- Thread: eChat App w/ server 2.0 (/Thread-eChat-App-w-server-2-0) Pages:
1
2
|
RE: eChat App w/ server 2.0 - darthjames226 - 12-05-2013 I just updated the source code to this program to eChat 2.0. The change in the code is as follows: I re-factored the code by cleaning it up a bit and tied up some loose ends with the advice from @Deque. I used DISPOSE_ON_CLOSE for the Client close operation instead of EXIT_ON_CLOSE. @Deque already explained why I should make that change. The OutputStream ArrayList in the server has been changed to a more descriptive name MessageWriters Fixed the ArrayList in the server by adding a object type to it. It now reads ArrayList<MessageWriters> in the server code. The server now has a GUI which displays the traffic of the server. The server can be shutdown properly now using the GUI. Both the server and client have a JLabel at the top of the screen indicating if a connection between the server/client has been made or failed to connect. Try/catch blocks does not catch all exceptions anymore. While-loop has been removed from the server code to use a more clean for-each loop. the Iterator object and namespace has been removed because it is no longer needed while using the for-each. Reader/Writer Streams closed. When you send a message in the client, the text box is cleared allowing the user to retype a message without deleting the previously sent one. All class fields have been changed to private. Methods have been changed to a more restricted access level. Enjoy the update and inform me of any bugs. RE: eChat App w/ server 2.0 - darthjames226 - 12-05-2013 I just updated the source code to this program to eChat 2.0. The change in the code is as follows: I re-factored the code by cleaning it up a bit and tied up some loose ends with the advice from @Deque. I used DISPOSE_ON_CLOSE for the Client close operation instead of EXIT_ON_CLOSE. @Deque already explained why I should make that change. The OutputStream ArrayList in the server has been changed to a more descriptive name MessageWriters Fixed the ArrayList in the server by adding a object type to it. It now reads ArrayList<MessageWriters> in the server code. The server now has a GUI which displays the traffic of the server. The server can be shutdown properly now using the GUI. Both the server and client have a JLabel at the top of the screen indicating if a connection between the server/client has been made or failed to connect. Try/catch blocks does not catch all exceptions anymore. While-loop has been removed from the server code to use a more clean for-each loop. the Iterator object and namespace has been removed because it is no longer needed while using the for-each. Reader/Writer Streams closed. When you send a message in the client, the text box is cleared allowing the user to retype a message without deleting the previously sent one. All class fields have been changed to private. Methods have been changed to a more restricted access level. Enjoy the update and inform me of any bugs. |