SDChat - CS 580 Client-Server Programming Spring Semester,...

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

View Full Document Right Arrow Icon
CS 580 Client-Server Programming Spring Semester, 2009 Doc 5 SDChat, Streams, Parsing 9 Feb, 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.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Chat 2 Server text text Client 1 Client 2
Background image of page 2
SDChat Commands 3 "available" "login" "register" "nickname" "startconversation" "quit" "waitinglist" "acceptconversation" "message" "rejectconnection" "endconversation"
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 identifier;key:value;key2:value2;; identifier;; identifier:value;; identifier:value;key:value;; login;nickname:foo;password:foopass;; quit;; ok:quit;; ok:1;nickname:bar;
Background image of page 4
Metacharacters 5 SDChat metacharacters \ : ; character with special meaning to a computer program
Background image of page 5

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

View Full DocumentRight Arrow Icon
6 login;nickname:foo;password:cat;;password:foopass;; What happens when a nickname contains metacharacter? nickname = foo;password:cat; How to parse:
Background image of page 6
7 Metacharacters in values must be escaped with "\" login;nickname:foo\;password\:cat\;;password:foopass;; When reading from network clients need to unescape values
Background image of page 7

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

View Full DocumentRight Arrow Icon
8 Identifiers & keys do not contain metacharacters
Background image of page 8
Connection (server) States 9 Start authenticated Conversation handshake Conversation login register Exit nickname quit startconversation acceptconversation rejectconversation message endconversation quit waitinglist available
Background image of page 9

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

View Full DocumentRight Arrow Icon
Sample Timeline 10 Server Client bar Client foo login available login ok:success;; ok:success;; ok:success;; waitinglist ok:1;nickname:bar;; startconversation:bar;; acceptconversation;; requestconversation;user:foo;; acceptconversation;;
Background image of page 10
Sample Timeline Continued 11 Server Client bar Client foo startconversation:bar;; acceptconversation;; requestconversation;user:foo;; acceptconversation;; mesage;text:a;; mesage;text:b;sender:bar;time:xx;; ;; mesage;text:b;; mesage;text:a;sender:foo;time:xx;; endconversation;; endconversation;;
Background image of page 11

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

View Full DocumentRight Arrow Icon
No newline in protocol 12 message end in ";;" So readline will not work
Background image of page 12
ok:1;nickname:bar;; 13 Entire protocol is in text The "1" is the string representation of the number one
Background image of page 13

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

View Full DocumentRight Arrow Icon
Timestamp format 14 02/08/2010 20:13:37
Background image of page 14
15 Java Streams
Background image of page 15

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

View Full DocumentRight Arrow Icon
16 int available() void close() abstract int read()