Skip to content

cotse900/Instant-chat-server-Java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Instant-chat-server-Java

To set up a server, we borrow from javafx.* and net.*, among other things. We set out an array list of clients (users) and a TextArea simply to show output, as well as an optional client number for every instance of a client window. Set out a Scene and a Stage, we start a Thread to try ServerSocket through a given available port which upon connection shows the time when the server started. While connection holds, Socket is accepted and is ready to entertain at least one Chat instance. The broadcast function takes care of writing chat messages on both Server and Chat windows and optionally saving a chat record. With private class Chat implements Runnable, set out a constructor of Chat and run with a range of elements including such libraries as Scanner for chats and PrintWriter. It shows the dynamics of Chat sessions, namely whether it has entered or has quit.

Chat is slightly more coding. It sets out elements like TextArea for server messages and chats. Dependent on a connected sockete with a Server session, Chat collects chats that both Chat and Server will show. In the start() function, it is an optional feature to require the user to decide on the Client session name. I optimized the message typing box and send button to allow longer messages and across multiple lines.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages