CS3516 A15 Help Session 1 CS3516 — TCP/IP Socket Programming Presented by Oleksandr Narykov

Slides:



Advertisements
Similar presentations
Module R2 CS450. Next Week R1 is due next Friday ▫Bring manuals in a binder - make sure to have a cover page with group number, module, and date. You.
Advertisements

HTTP Cookies. CPSC Application Layer 2 User-server state: cookies Many major Web sites use cookies Four components: 1) cookie header line of HTTP.
COEN 445 Communication Networks and Protocols Lab 4
28.2 Functionality Application Software Provides Applications supply the high-level services that user access, and determine how users perceive the capabilities.
CS3516 (B10) HELP Session 2 Presented by Lei Cao.
CS3516 B10 Help Session 1 CS3516 — TCP/IP Socket Programming Presented by Can (John) Tatar.
COSC 120 Computer Programming
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Fundamentals of Strings and Characters Characters.
Internet Applications: Telnet, Ping and Traceroute.
CSCI 4550/8556 Computer Networks Comer, Chapter 3: Network Programming and Applications.
COS 420 DAY 25. Agenda Assignment 5 posted Chap Due May 4 Final exam will be take home and handed out May 4 and Due May 10 Latest version of Protocol.
CS4514 B05 HELP Session 1 CS4514 – TCP/IP Socket Programming Presented by Feng Li
1 © 2003, Cisco Systems, Inc. All rights reserved. CCNA 1 v3.0 Module 11 TCP/IP Transport and Application Layers.
RPC Project Using either sockets or TLI, implement Remote Procedure Calls between two distinct machines that are communicating over an Ethernet network.
Online Chess Project 3 Due date: April 17 th. Introduction Third in series of three projects This project focuses on adding online support –2 players.
Guide To UNIX Using Linux Third Edition
Tutorial 5 Creating Advanced Queries and Enhancing Table Design
TCP: Software for Reliable Communication. Spring 2002Computer Networks Applications Internet: a Collection of Disparate Networks Different goals: Speed,
3D Object Retrieval Client-Server Project
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public 1 Version 4.0 Application Layer Functionality and Protocols Network Fundamentals – Chapter.
Server Design Discuss Design issues for Servers Review Server Creation in Linux.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
NETWORK CENTRIC COMPUTING (With included EMBEDDED SYSTEMS)
TCP/IP Protocol Stack IP Device Drivers TCPUDP Application Sockets (Gate to network) TCP: –Establish connection –Maintain connection during the communication.
Agenda  Terminal Handling in Unix File Descriptors Opening/Assigning & Closing Sockets Types of Sockets – Internal(Local) vs. Network(Internet) Programming.
Introduction to C programming
FTP (File Transfer Protocol) & Telnet
1 Chapter Client-Server Interaction. 2 Functionality  Transport layer and layers below  Basic communication  Reliability  Application layer.
CCNA 1 v3.0 Module 11 TCP/IP Transport and Application Layers.
THE OSI MODEL AND THE TCP/IP PROTOCOL SUITE CS 1202 Lectur3 part2.
Agenda Overview of Seneca Computer System –File Servers / Student Computer Accounts –Telnet application –How to Logon to Learn / Phobos accounts How to.
The OSI Model and the TCP/IP Protocol Suite Outline: 1.Protocol Layers 2.OSI Model 3.TCP/IP Model 4.Addressing 1.
Learningcomputer.com SQL Server 2008 Configuration Manager.
1 CSC111H Client-Server: An Introduction Dennis Burford
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
1 © 2003, Cisco Systems, Inc. All rights reserved. CCNA 1 v3.0 Module 11 TCP/IP Transport and Application Layers.
Lesson 1-Logging On to the System. Overview Importance of UNIX/Linux. Logging on to the system.
Character Arrays Based on the original work by Dr. Roger deBry Version 1.0.
Chapter 15 – Part 2 Networks The Internal Operating System The Architecture of Computer Hardware and Systems Software: An Information Technology Approach.
The Socket Interface Chapter 21. Application Program Interface (API) Interface used between application programs and TCP/IP protocols Interface used between.
Agenda Overview of Seneca Computer System File Servers / Student Computer Accounts Telnet application How to Logon to Learn / Phobos accounts How to Change.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
GAME203 – C Files stdio.h C standard Input/Output “getchar()”
DAY 18: MICROSOFT ACCESS – CHAPTER 3 CONTD. Akhila Kondai October 21, 2013.
Agenda Overview of Seneca Computer System File Servers / Student Computer Accounts Telnet application How to Logon to Learn / Phobos accounts How to Change.
Chapter 8 Characters and Strings. Objectives In this chapter, you will learn: –To be able to use the functions of the character handling library ( ctype).
CS440 Computer Networks 1 Neil Tang 12/01/2008.
C++ Programming Lecture 19 Strings The Hashemite University Computer Engineering Department (Adapted from the textbook slides)
Data Communications and Computer Networks Chapter 2 CS 3830 Lecture 7 Omar Meqdadi Department of Computer Science and Software Engineering University of.
Characters and Strings
Announcements Assignment 1 will be regraded for all who’s score (not percentage) is less than 6 (out of 65). If your score is 6 or higher, but you feel.
Technical lssues for the Knowledge Engineering Competition Stefan Edelkamp Jeremy Frank.
C Programming Day 2. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/LA07/003 Version No. 1.0 Union –mechanism to create user defined data types.
Principles of Programming - NI Chapter 10: Character & String : In this chapter, you’ll learn about; Fundamentals of Strings and Characters The difference.
MICROSOFT ACCESS – CHAPTER 3 CONTD. Sravanthi Lakkimsetty Mar 09, 2016.
CS470 Programming Assignment 1 Zilong Ye. A Chat Application Goal: learn socket programming and implement a chat application for exchanging messages between.
Network Programming. These days almost all devices.
COMP2322 Lab 4 Socket Programming
The OSI Model and the TCP/IP Protocol Suite
File Transfer and access
Chapter 2 part #3 C++ Input / Output
The OSI Model and the TCP/IP Protocol Suite
Architecture Competency Group
CS3516 — TCP/IP Socket Programming
Chapter 2 part #3 C++ Input / Output
The OSI Model and the TCP/IP Protocol Suite
Presentation transcript:

CS3516 A15 Help Session 1 CS3516 — TCP/IP Socket Programming Presented by Oleksandr Narykov

CS3516 — TCP/IP Socket Programming 2 Outline  Project 1 Overview  Processing commands  How to find help and other tips.

CS3516 — TCP/IP Socket Programming 3 CS3516 Project1  Your programs should compile and work on ccc.wpi.edu computers, which are running Linux.  Programs should be written in C or C++.  If your program is developed on another platform or machine, you should test the software on ccc before turning in the assignment.  Make sure you have the correct #include commands in your program.

CS3516 — TCP/IP Socket Programming 4 Project 1 missions (in handout)  The Client: 1.Reading a command from a script file “LClient.txt” or from console. 2.Sending the command to the server. 3.Receiving and displaying the information from the server. 4.Writing the results to the log file LClient.log.

CS3516 — TCP/IP Socket Programming 5 Project 1 missions (in handout)  Server: 1.Processing the command from the client and return the result to the client. 2.Maintaining the records to keep the location information. 3.Writing the complete database to the file LDatabase.txt when the server received the “ quit EOF ” command.

CS3516 — TCP/IP Socket Programming 6 Outline  Project 1 Overview  Processing commands  How to find help and other tips.

CS3516 — TCP/IP Socket Programming 7 Processing commands  Each command triggers a communication conversion, between client and server. Then, we have  login  add  update  remove  find  locate  quit  list (attn: this one is different from above commands, most complex one).

CS3516 — TCP/IP Socket Programming 8 Commands  In the login, add, remove, and quit commands: The server only returns one message to the client.  In the list, find, locate commands, the server may return multiple messages to the client. “ Each entry, which meets the search condition, is sent as a separate TCP message back to the Client. ”

CS3516 — TCP/IP Socket Programming 9 Login Command  Login Command Format. login name  Login Command Handling  For The Client: When the Client reads a login command, the client establishes a TCP connection to the Server.  For The Server: When the Server receives a “ login name ”, it replies “ Hello, name! ” to the client.

CS3516 — TCP/IP Socket Programming 10 Add Command  Add Command Format: add id_number first_name last_name gender location Notes:  first_name, last_name, gender and location are nonblank ASCII string. For example: add Tony Smith M 12_Institute_rd_worcester  id_number is 9 digital number similar to SSN number. (example shown: )  For the Client: reads and sends the add command to the server, and displays the result returned from server.

CS3516 — TCP/IP Socket Programming 11 Add Command (cont ’ d)  For the Server: When the server gets the Add command, it will  add the five items as an entry into the location database in the proper location, and return a successful message to client.  If a duplicate id_number is received, the server sends an error message back to the client.  If the command ’ s parameter is not valid, the server returns an Error message to the client. For example, Add Tony Smith M worcester, MA returns “ an invalid add command ”.

CS3516 — TCP/IP Socket Programming 12 Find Command  Find Command Format: find first_name last_name Notes:  first_name, last_name are nonblank ASCII string. For example find Donald Trump  For the Client: reads and sends the find command to the server, and displays the result returned from server.

CS3516 — TCP/IP Socket Programming 13 Find Command (cont ’ d)  For the Server: When the server gets the Find command, it will  Search database entries  Return matched results. One TCP packet per result.  If nothing was found, return message indicating this.

CS3516 — TCP/IP Socket Programming 14 Locate Command  Locate Command Format: locate location  For the Client: reads and sends the locate command to the server, and displays the result returned from server.

CS3516 — TCP/IP Socket Programming 15 Find Command (cont ’ d)  For the Server: When the server gets the Locate command, it will  Search database entries.  All entries with matching location would be sent to the client. One TCP packet per entry. Entries should be sent in alphabetical order by last name!  If nothing was found, return message indicating this.  Note – location has to be an exact match but case-insensitive.

CS3516 — TCP/IP Socket Programming 16 Update Command  Update Command Format: update id_number first_name last_name gender location Notes: Requirements are the same as for add command  For the Client: reads and sends the update command to the server, and displays the result returned from server.  For the Server: sends back an error of id_number is not in the database.

CS3516 — TCP/IP Socket Programming 17 Remove Command  Remove command format remove id_number example: “ remove ” is a valid command.  For the Client, sends the remove command to the server, and displays the result returned from server.

CS3516 — TCP/IP Socket Programming 18 Remove command (cont ’ d)  For the Server, When the server receives remove command, the server searches the database for a match on id_number.  If the id_number entry exists in the database for a person, that entry is removed from the location database and a success message that contains the first and last name of the person removed is sent back to the Client.  If there is not a match in the database, the server does not modify the database and sends an appropriate error message back to the Client.

CS3516 — TCP/IP Socket Programming 19 Quit Command  Quit Command format: quit [EOF] For example, quit and quit EOF are valid commands.  For the Client  sends the quit command to the server, and when the client received the response message from the server, the client knows the connection will be closed.  If EOF is specified, the client will close the log file, and terminate.

CS3516 — TCP/IP Socket Programming 20 Quit Command (Cont ’ d)  For the Server,  When server received quit command, it sends a response back to the Client indicating that the connection will be closed and including a count of the number of commands that are issued by name. The server returns to wait for a new connection triggered by a subsequent login request.  If quit EOF is received, the Server additionally writes out the complete database to the file LDatabase.txt and sends back to the Location Client a count of the number of clients processed, then terminates.

CS3516 — TCP/IP Socket Programming 21 List Command  List Command format list start [finish] Notes: start – one character finish – one character but optioal Examples:  list Find and list all the entries in the database.  list A Find and list the entries, whose last_name starts with A  list A d Find the entries, whose last_name starts with any letter between A and D including both A and D. Note – finish must be later in the alphabet than start.

CS3516 — TCP/IP Socket Programming 22 List Command (cont ’ d)  For the Client: Sends the command to the server, and displays the response messages from the server.  For the Server: When it receives the list command:  sends all location entries satisfying the list limits.  sends “ no such records ” if there are no entries satisfying the list request.  sends “ invalid command ” if the list command is in illegal format.  example  list Aa  list Aa B  list A Bb  list Bb Aa

CS3516 — TCP/IP Socket Programming 23 Outline  Project 1 Overview  Unix Network Programming  TCP Client  TCP Server  Processing a command  How to find help and other tips.

CS3516 — TCP/IP Socket Programming 24 Server Database There are many possible data structure choices for implementing the server data base. Two of them are:  Linked list: Easy to add/remove an entry.  Array: The simplest data structure.

CS3516 — TCP/IP Socket Programming 25 Sorting in Database  The server ’ s database is sorted ascending by last_name AND in chronological order. For example, (based on a linked list) last_namefirst_nameid,location AndySmith … BushJerry … Ldatabase.txt

CS3516 — TCP/IP Socket Programming 26 String comparison  The case insensitive string compare functions in Linux.  int strcasecmp(const char *s1, const char *s2);  int strncasecmp(const char *s1, const char *s2, size_t n);  Their usage is similar to strcmp() function.  An Alternative method. Storing the information in upper case letters in server ’ s database. (Smith -> SMITH )

CS3516 — TCP/IP Socket Programming 27 HELP  Bring printouts to office hours.  questions to Prof.+TAs (cs3516-ta “at” cs.wpi.edu), but do NOT expect immediate results, better to attend office hours.  My Office Hours: Mon, 4:00-6:00pm; Fri, 4-6pm  Dongqing Xiao’s Office Hours: Tue, 2-4pm; Thu, 2-4pm  We do have a class mailing list that could be used as a last resort.

CS3516 — TCP/IP Socket Programming 28 Questions?

CS3516 — TCP/IP Socket Programming 29 More Tips: file and stdio  In Linux, a device could be treated as a file. For example, the standard input device could be handled as a file. /* fgets() will read a line from the keyboard. */ fp=stdin; fgets(buffer, buffer_len, fp); /* next fgets() will read a line from the file named “ script.txt ”. */ fp=fopen( “ script.txt ”, “ r ” ); fgets(buffer, buffer_len, fp);

CS3516 — TCP/IP Socket Programming 30 References  Beej's Guide to Network Programming  The GNU C Library  IBM iSeries Information Center  The Open Group Base Specifications  Wikipedia