NioLoggingConfiguration

- CS 580 Client-Server Programming Spring Semester 2010 Doc 11 NIO Logging,Configuration 4 March 2010 Copyright All rights reserved 2010 SDSU

Info iconThis preview shows pages 1–15. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 580 Client-Server Programming Spring Semester, 2010 Doc 11 NIO, Logging,Configuration 4 March, 2010 Copyright ©, All rights reserved. 2010 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA. OpenContent ( http:// www.opencontent.org/opl.shtml ) license defines the copyright on this document. 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Reference 2 Java On-line API, http://java.sun.com/javase/6/docs/api/ SDSU Java Library, http://www.eli.sdsu.edu/java-SDSU/ 2
Background image of page 2
3 Assignment 3 part 2 Comments 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Names 4 serverPort = new javax.swing.JTextField(); serverName = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); serverStatus = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); 4
Background image of page 4
About that comment 5 public String[] chatWaitingList() throws Exception { String[] newList; if ( currentState > START ) { //String currentList = sendAndReceive("waitingList;;"); String currentList = "ok:1;nickname:biteme;;"; if ( currentList.indexOf(";nickname:") >= 0 ) { currentList = currentList.substring(currentList.indexOf(";nickname:")+10, currentList.length() - 2); newList = currentList.split(";nickname:"); for ( int ctr = 0; ctr < newList.length; ctr++ ) newList[ctr] = unescapeString(newList[ctr]); } else newList = new String[0]; return newList; } return null; } 5
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Include your external Libraries 6 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 6
Background image of page 6
Duh 7 // Static variables private static final int START = 0; private static final int AUTHENTICATED = 1; private static final int HANDSHAKE = 2; 7
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Hard Coded 8 private void loginButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN- FIRST:event_loginButtonActionPerformed if (chatClient == null) { chatClient = new SDChatClient("bismarck.sdsu.edu", 8009); } String password = ""; for (int i = 0; i < passwordField.getPassword().length; i++) { password += passwordField.getPassword()[i]; } boolean success = chatClient.login(nicknameTextField.getText(), password); if (success) { dispose(); new SDChatWaitingListFrame(chatClient).setVisible(true); } else { displayError("Login Failed!"); } }//GEN-LAST:event_loginButtonActionPerformed 8
Background image of page 8
Packages 9 9
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
What happens with Exceptions 10 Turn off your network connections Run your Client Try connecting to the server What happens? 10
Background image of page 10
Which class to Start the Application? 11 11
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
12 NIO 12
Background image of page 12
Motivation 13 public class SomeClientThread extends Thread { private Socket connection; public SomeCleintThread(Socket toServer) { connection = toServer; } public run() { InputStream rawIn = connection.getInputStream(); BufferedReader in = new BufferedReader(new InputStreamReader(rawIn)); while ( !isInterrupted() ) { String answer = in.readLine(); process input here } in.close(); } } 13
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
14 User makes a request Client code connects to server User changes mind - clicks on "Stop" button "Stop" button sends interrupt to thread What happens? 14
Background image of page 14
Image of page 15
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/16/2011 for the course CS 580 taught by Professor Rogerwhitney during the Spring '11 term at Community college of RI.

Page1 / 52

- CS 580 Client-Server Programming Spring Semester 2010 Doc 11 NIO Logging,Configuration 4 March 2010 Copyright All rights reserved 2010 SDSU

This preview shows document pages 1 - 15. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online