This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
The user gets authenticated just fine, but when I try to send the "user: has joined the us" message to everyone it does not get sent. The tellEveryone method runs and the System.out.println statements work. Also when I try and send a regular message it does not get sent.
The code looks great but I cannot figure out how to change it up so I can use a GUI. I have been trying to figure what to do so I can use a login window instead of command line most of the day. Nothing seems to work. Any hints/tips on this? Here's the sections of the code I modified
Showing login screen and sending username and password to be authenticated
I am sending to the server the login string "#loginusername/password
It does not compile, doee not like line msg = reader.readline();
Here's what I have. The only problem I'm having so far is when I fail to use a proper username password it will not let me try again. I mean I can send a msgbox saying incorrect login and reset the text boxes and set focus on username, but when I try to login again it does not seem to work. Hope this makes sense.
carey brown wrote:You need two additions: 1) a way for the server to pass back to a specific client if their login attempt passed or failed, 2) a loop in the client to keep prompting until a 'pass' message is received.
the success or failure of logging in is passed back to the client right now. I just need to work on the loop. Thanks.
Okay I have tweaked the client code now. Before when the login screen was a seperate window it worked fine, but when I make the login screen a dialog box I suddenly cannot login. The server gets the message and login is accepted on the server but the message does not get sent back to the client. The code commented out is that code I used to make the seperate login window work-which makes the program work.
I am only posting the client code, the server code is that same as posted earlier
Okay it's still not working and I've looked over the code the best I can. I have one client program that works and one that does not. The one that works uses a seperate window for the login screen and the other client program uses a dialog box for the login screen. Here the code to it all! I cannot for the life of me figure out why that one does not work. The client sends the login details to the server, the servers authenticates and sends back a response but the client does not recieve the response.
Whoops here's the server code did not realize I posted the server connection code twice.
at least I hope this code works, I was trying to use Netbeans to figure this out and seemed to have deleted the code.