meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
courses:ct30a5000:assignment3 [2012/08/22 14:50]
julaakko [Protocol packets and data types from server to client:]
courses:ct30a5000:assignment3 [2012/09/10 13:26] (current)
julaakko
Line 1: Line 1:
-Network programming [[https://​noppa.lut.fi/​noppa/​opintojakso/​ct30a5000/etusivu|@ Noppa]] | [[courses:​ct30a5000:​start|@ wiki]] -  +Network programming [[https://​noppa.lut.fi/​noppa/​opintojakso/​ct30a5001/etusivu|@ Noppa]] | [[courses:​ct30a5000:​start|@ wiki]] -  
-Updated: ​ --- //​[[jussi.laakkonen@lut.fi|Jussi Laakkonen]] 2012/08/22 11:46//+Updated: ​ --- //​[[jussi.laakkonen@lut.fi|Jussi Laakkonen]] 2012/09/10 11:42//
  
 ---- ----
Line 6: Line 6:
 Updates: Updates:
 > 22.8.2012: Initial version. > 22.8.2012: Initial version.
 +> 22.8.2012: Text-file based database set as a requirement.
 +> 22.8.2012: Added sequence diagram.
 +> 10.9.2012: Added clarification for error message sending.
  
 ====== Assignment3:​ Aphorism exchange system ​ ====== ====== Assignment3:​ Aphorism exchange system ​ ======
Line 15: Line 18:
 Client can either add aphorisms to the database of the server or retrieve them from the server'​s database. The client sends a message to server, waits for a response from the server, informs the user about response and then quits. Client should get the command from a command line parameter. When adding an aphorism the client must request the aphorism from the user (via standard input). Client can either add aphorisms to the database of the server or retrieve them from the server'​s database. The client sends a message to server, waits for a response from the server, informs the user about response and then quits. Client should get the command from a command line parameter. When adding an aphorism the client must request the aphorism from the user (via standard input).
  
-Server can store up to 10 aphorisms and serves one request at a time. It is required to store the IP-address of the sender with the exact date and time along the sent aphorism. Save this information to a text file when server is quitting and load it at startup. When server is run for the first time (no database exists yet) it will start with an empty database and the text file is created. **OPTIONAL** update the content of the text file every time new aphorism is added. If the database is full server should response with appropriate message. If the command is not recognized server should return usage instructions in a message.+Server can store up to 10 aphorisms and serves one request at a time. It is required to store the IP-address of the sender with the exact date and time along the sent aphorism ​(feel free to select the format). Save this information to a text file when server is quitting and load it at startup. When server is run for the first time (no database exists yet) it will start with an empty database and the text file is created. **OPTIONAL** update the content of the text file every time new aphorism is added. If the database is full server should response with appropriate message. If the command is not recognized server should return usage instructions in a message.
  
 Server must not crash if it receives something else than described in the protocol. Same applies for client. Client must inform the user if server is not found. Client must not Server must not crash if it receives something else than described in the protocol. Same applies for client. Client must inform the user if server is not found. Client must not
 crash because of the invalid input given by user. crash because of the invalid input given by user.
  
-IPv4 and IPv6 must be supported. Use ''​AF_INET6''​ type socket and allow data from IPv4 mapped addresses although there exists some risks with this. For more details see [[http://​tldp.org/​HOWTO/​html_single/​Linux+IPv6-HOWTO/#​CHAPTER-SECTION-USING-API|TLDP.org Linux IPv6 HOWTO 23.1.3.1. IPv4 Mapped Addresses]] and/or read chapter 4.3 in IPv6 Network Programming book.+IPv4 and IPv6 must be supported. Use ''​PF_INET6''​ type socket and allow data from IPv4 mapped addresses although there exists some risks with this. For more details see [[http://​tldp.org/​HOWTO/​html_single/​Linux+IPv6-HOWTO/#​CHAPTER-SECTION-USING-API|TLDP.org Linux IPv6 HOWTO 23.1.3.1. IPv4 Mapped Addresses]] and/or read chapter 4.3 in IPv6 Network Programming book.
  
 ==== Requirements ==== ==== Requirements ====
Line 41: Line 44:
         * <​listening port> - Port that server listens for incoming datagrams         * <​listening port> - Port that server listens for incoming datagrams
       * Can store 10 aphorisms.       * Can store 10 aphorisms.
 +        * Data to save: aphorism, who sent (IP), when (date & time)
         * Save aphorisms into a text-file when the server is terminated.         * Save aphorisms into a text-file when the server is terminated.
         * Read aphorisms from a text-file into database when starting the server.         * Read aphorisms from a text-file into database when starting the server.
Line 46: Line 50:
       * Server must serve one request at a time. After serving one request process the next one.       * Server must serve one request at a time. After serving one request process the next one.
       * Iterative, no threads or ''​fork()''​.       * Iterative, no threads or ''​fork()''​.
-==== Protocol ​messages ​====+ 
 +===== Protocol ===== 
 + 
 +==== Protocol ​packets and data types from client to server ​====
  
 === Add an aphorism === === Add an aphorism ===
Line 91: Line 98:
 | ERR          | Error message ​      | | ERR          | Error message ​      |
  
-Error message, sent when database is empty (response to GET) or full (response to ADD). Sent also when command is not recognized, in this case usage instructions are sent to client (separate commands to multiple lines).+Error message, sent when database is empty (response to GET) or full (response to ADD). Sent also when the aphorism is too long or command is not recognized, in this case usage instructions are sent to client (separate commands to multiple lines).
 Example:​ERRDatabase is full.\0 Example:​ERRDatabase is full.\0
 +
 +==== Sequence diagram ====
 +
 +{{:​courses:​ct30a5000:​2012_third_assignment_sequence.png?​400|}}
 +
  
 ===== Additional notes and hints ===== ===== Additional notes and hints =====