telnet Client User Interface for Accessing MX7cK s push buttons and LEDs. Template for P1.3

Similar documents
Beijer Electronics AB 2000, MA00453,

J2 LCM Customer Display. Manual

2a. Codes and number systems (continued) How to get the binary representation of an integer: special case of application of the inverse Horner scheme

UniOP VT100 Terminal Emulation - Ver. 3.16

AccuTerm Mobile. User Guide

Number Representations

CS 43: Computer Networks. Layering & HTTP September 7, 2018

Number Systems for Computers. Outline of Introduction. Binary, Octal and Hexadecimal numbers. Issues for Binary Representation of Numbers

Data Representation and Binary Arithmetic. Lecture 2

EE 109 Unit 2. Binary Representation Systems

EXPERIMENT 8: Introduction to Universal Serial Asynchronous Receive Transmit (USART)

3.1. Unit 3. Binary Representation

Exercises Software Development I. 03 Data Representation. Data types, range of values, internal format, literals. October 22nd, 2014

Chapter 3. Information Representation

PD1100 STAND-ALONE PROGRAMMING & USER S GUIDE. use the freedom

Application Level Protocols


Chapter 3 : Informatics Practices. Class XI ( As per CBSE Board) Python Fundamentals. Visit : python.mykvs.in for regular updates

CPS 104 Computer Organization and Programming Lecture-2 : Data representations,

S-Series Sensor ASCII Protocol v8.1.0

PD26xx/PD23xx/PD28xx Series Command Detail Manual

C H A P T E R lpr Overview of the Print Server Program UNIX Print Facility lpr 8-1

Data Representa5on. CSC 2400: Computer Systems. What kinds of data do we need to represent?

Data Representa5on. CSC 2400: Computer Systems. What kinds of data do we need to represent?

LCD03 - I2C/Serial LCD Technical Documentation

EE 109 Unit 2. Analog vs. Digital. Analog vs. Digital. Binary Representation Systems ANALOG VS. DIGITAL

ECE697AA Lecture 2. Today s lecture

6.096 Introduction to C++ January (IAP) 2009

Sending MAC Address Function

APEX & ANDES Series. Printer Command Language Developer s Manual

EXPERIMENT 7: Introduction to Universal Serial Asynchronous Receive Transmit (USART)

Introduction to C++ IT 1033: Fundamentals of Programming

i Term 1U Rack Mount Terminal

LCD03 - I2C/Serial LCD Technical Documentation

LCD05 datasheet 1.0

1602 SMART LCD DISPLAY MODULE HCMODU0122

TCP/IP Networking Basics

Analyzing the command string for switch to input #

RoboRemo User Manual v1.9.1

MOBILE THERMAL PRINTER

Telnet/KSHELL NETIO M2M API protocols docs

ACS-LCD-128x64. LCD Graphic Display Terminal. General Description. Features. Typical Applications. Specifications. 22-Feb-08

EE 109 Unit 3. Analog vs. Digital. Analog vs. Digital. Binary Representation Systems ANALOG VS. DIGITAL

RS-232 Control of the Advantage EQ281/8, EQ282/8 and Advantage SMS200

Application Layer Introduction; HTTP; FTP

CS6421: Distributed Systems

1.1. INTRODUCTION 1.2. NUMBER SYSTEMS

Introduction. This section describes the cursor positioning commands.

Memory, Data, & Addressing II CSE 351 Spring

Application Protocols and HTTP

Chapter 2 Number System

CS321: Computer Networks FTP, TELNET, SSH

Lab5 2-Nov-18, due 16-Nov-18 (2 weeks duration) Lab6 16-Nov-19, due 30-Nov-18 (2 weeks duration)

melabs Serial LCD Firmware Version 1.1 3/5/07

Command Manual SRP-350 Thermal Printer Rev. 1.01

Review of Previous Lecture

Fics-RT1. User s Manual

blu2i Obex Push Client Host - Module Protocol Specification

Overview. - General Data Types - Categories of Words. - Define Before Use. - The Three S s. - End of Statement - My First Program

QTERM-J10/N15 USER'S MANUAL REVISION 13

FEC-240G. Rev. Date

Using the Command-Line Interface

ENCM 339 Fall 2017 Lecture Section 01 Lab 3 for the Week of October 2

LESSON 4. The DATA TYPE char

Experiment 3. TITLE Optional: Write here the Title of your program.model SMALL This directive defines the memory model used in the program.

Chapter 8. Characters and Strings

CipherLab Terminal Emulation. Supporting team Syntech Information Co., Ltd.

CMSC 313 Lecture 03 Multiple-byte data big-endian vs little-endian sign extension Multiplication and division Floating point formats Character Codes

Network Reference Models

8-bit Microcontroller Application Note AVR244: AVR UART as ANSI Terminal Interface

Next Generation Intelligent LCDs

COMP 2718: The OS, Shell, Terminal, and Text

MK D Imager Barcode Scanner Configuration Guide

Java Basic Datatypees

Datapanel. VT100 Terminal Emulator for Datapanels. Operator Interface Products. User's Manual

Compiler Construction Assignment 2 Fall 2009

SPP-R210 Command Manual Rev. 1.00

Do not start the test until instructed to do so!

Ultimate-II MPS Printer Emulation

A programmer can create Internet application software without understanding the underlying network technology or communication protocols.

[MS-VUVP]: Intellectual Property Rights Notice for Open Specifications Documentation

INT 21H and INT 10H Programming and Macros

ASSIGNMENT 5 TIPS AND TRICKS

SC1602LC 16x2 Large Characters RS232 LCD Module. User s Manual. Large Viewing Area 99mm x 24mm. Large Character Size. 4.84mm x 9.66mm.

Trident Z Royal. Royal Lighting Control Software Guide

TORRIX RS485. Technical Documentation. with MODBUS Protocol. Edition: Version: 3 Art. no.:

Data Representation COE 301. Computer Organization Prof. Muhamed Mudawar

LRVC Protocols. L R V C P r o t o c o l s P a g e 1. Revision History: Date Version Author Changes. 1/28/2012 v0.1 Matthew Wickesberg Initial draft.

Home Page for the UPC-E

Intel Architecture Segment:Offset Memory Addressing

COMPUTER NETWORK. Homework #1. Due Date: March 29, 2017 in class

CSE/EE 461 HTTP and the Web

Models: TD3000 Series. Table Displays. 2 by 20 character display USER MANUAL

CS132/EECS148 - Instructor: Karim El Defrawy Midterm Spring 2013 Time: 1hour May 2nd, 2013

Midterm Exam, Fall 2015 Date: October 29th, 2015

AN5179. RS232 communications with a terminal using the STM8 Nucleo-64 boards. Application note. Introduction

Revision 1.0.0, 5/30/14

Programming in C++ 4. The lexical basis of C++

ELEC / COMP 177 Fall Some slides from Kurose and Ross, Computer Networking, 5 th Edition

Black Box DCX3000 / DCX1000 Using the API

Transcription:

telnet Client User Interface for Accessing MX7cK s push buttons and LEDs. Template for P1.3 1

Motivation for Using telnet We have written a ToUpper server that uses TCP and runs on the TCP/IP stack of the MX7ck board. We need a TCP client to connect to this server in order to test the server. Instead of writing a TCP client at this time, we will use a given telnet client program, which is provided by the OS. In basic telnet, the peer-to-peer communications protocol is straight ASCII text sent over a TCP connection. The telnet client program does not define a carrier protocol, to carry the straight text. Therefore, it is not necessary to connect to a telnet server. We will connect the telnet client to our TCP server, directly, and thus have a means of testing it. 2

What is telnet? telnet is a network based client-server program that is available to run on many popular operating systems, such as Windows, Mac, and Unix. telnet runs on the application layer. Unlike http and other application layer protocols, telnet is a complete program that does not need a network based program to run on top of it. Typically, a client user runs a telnet client program to connect to a telnet server to gain access to the resources of the server host computer. Network Based Program Application Layer (HTTP, telnet (client), others ) API Transport Layer (TCP, UDP, ) API Network Layer (IP, ) API Link Layer (Ethernet, WiFi, ) Network Based Program Application Layer (HTTP, telnet (server), others ) API Transport Layer (TCP, UDP, ) API Network Layer (IP, ) API Link Layer (Ethernet, WiFi, ) On Client Host Network On Server Host 3

What is telnet? A telnet client program runs on a computer terminal, typically a terminal that supports the VT100 standard. You run the program by typing its name in the terminal. A telnet server runs in the background on the Application Layer of the TCP/IP stack. Sometimes, a telnet server may have a user interface on the server host machine, but normally, there is no user interface to a telnet server. A client telnet program can connect to a telnet server on port 23. Telnet server runs in background On Client Host Network On Server Host 192.168.1.49 4

telnet is a Session Layer Protocol telnet is also known as a session layer protocol The session layer, which is built-in to telnet programs, provides the mechanism for opening, closing and managing a TCP session between telnet client and server programs. This means users of telnet do not write code for opening, closing and managing a TCP session; this code is already part of the telnet program. A telnet client user sends text messages to a telnet server, and the server responses are simple text messages. 5

telnet Defines No Carrier Protocol The basic telnet protocol defines no carrier protocol. It sends/receives messages using raw text format User application protocol language is transmitted in raw text format. I.e., user messages are sent from the client program to the server in raw format, and a carrier is not used. A telnet client and server use TCP for their connection This implies that a telnet client program does not need to connect with a telnet server running at port 23: A telnet client can successfully connect to a raw-text TCP server at any available port. In Project P1.3, our telnet server will be a raw-text TCP server whose port number is 7777. 6

Example of HTTP Session Here is an example of what a client web browser would send to a web server: GET /index.html HTTP/1.1 host: http://ece.eng.umanitoba.ca/undergraduate/ece3740/ Response sent by web server to web browser (client): HTTP/1.1 200 OK Date: Wed, 30 Sep 2015 10:08:00 GMT //other server information <html> <head> <title>......lots of HTML code here that defines the 3740 web page you see </body></html> Note: the carrier protocol in green (HTTP) and the application protocol language in blue (HTML). Note: that the server sends the user interface to the client web browser. Note: there could be also a user layer protocol on top of html. The user protocol would define a users interaction with the server via the html web page s objects, such as textbox, buttons, etc. 7

Example of telnet Session The following shows part of a user protocol on top of telnet. A user of a telnet program (telnet client) sends a message to the code within a telnet server, and a response received: Sent by user of telnet client to telnet server: Hello telnet server! Response sent by telnet server to telnet client: Hello telnet client! Notice there is no carrier protocol, but just a user layer protocol language in blue. 8

Examples given: a telnet server can provide services to: Access OS commands for manipulating files on the server s computer, like pwd, cd, copy, move, and delete. Configure devices connected to the server s machine Set bit rate of a COM port Enable different kinds of modulation and forward error correction for a modulator. The services a telnet server offers is application dependant, i.e., the services are whatever the designers of the telnet server decided to program into the server. For example, in our course, the telnet server is to provide services to: Rotate the LEDs on the MX7cK Get the status of the switches, LEDs, and sensors Turn on/off LEDs. Note: due to computer security concerns, many organizations no longer offer the basic telnet programs, since an adversary could gain access to a computer system relatively easily and cause damage or obtain confidential information. For example, should an adversary install a rogue TCP server on a host, then, it would be possible for the adversary to remotely connect to the server and proceed to cause damage to the host computer or download personal information. 9

telnet is a program that runs on a VT100 standard compatible terminal. The standard specifies a way to display and format the display or characters on a VT100 compatible computer terminal. Normally, a VT100 terminal software displays a sequence of ASCII characters that you send it, except for a special case: an Escape (ESC) character. When you send a message to a VT100 terminal that has the first character as the ANSI escape character ESC (1Bh), the VT100 software interprets the following characters of the message as codes for how to format the display or how to format a character for display. For example: 1B[2J // 1B is the hex encoded escape character; [2J means Clear the screen 10

For Text Attributes ANSI Description [0m Reset all attributes [1m Set bright attribute [2m Set dim attribute [4m Set underline attribute [5m Set blink attribute [7m Set reverse attribute [8m Set hidden attribute 11

Foreground Color (Text Color) ANSI Description [30m Set foreground to color #0 - black [31m Set foreground to color #1 - red [32m Set foreground to color #2 - green [33m Set foreground to color #3 - yellow [34m Set foreground to color #4 - blue [35m Set foreground to color #5 - magenta [36m Set foreground to color #6 - cyan [37m Set foreground to color #7 - white [39m Set default color as foreground color 12

Background Color ANSI Description [40m Set background to color #0 - black [41m Set background to color #1 - red [42m Set background to color #2 - green [43m Set background to color #3 - yellow [44m Set background to color #4 - blue [45m Set background to color #5 - magenta [46m Set background to color #6 - cyan [47m Set background to color #7 - white [49m Set default color as background color 13

For Editing Commands [P Delete character from cursor position [*P Delete * chars from cursor right [M Delete 1 line from cursor position [*M Delete * lines from cursor line down [J Erase screen from cursor to end [1J Erase beginning of screen to cursor [2J Erase entire screen but do not move cursor [K Erase line from cursor to end [1K Erase from beginning of line to cursor [2K Erase entire line but do not move cursor [L Insert 1 line from cursor position [*L Insert * lines from cursor position 14

General Codes Name Decimal Hex C-escape Description BEL 7 0x07 \a Terminal bell BS 8 0x08 \b Backspace HT 9 0x09 \t Horizontal TAB LF 10 0x0A \n Linefeed (newline) VT 11 0x0B \v Vertical TAB FF 12 0x0C \f Formfeed (also: New page NP) CR 13 0x0D \r Carriage return ESC 27 0x1B <none> Escape character DEL 127 0x7F <none> Delete character 15

P1.3: telnet Client User Interface Requirements Analysis Which component should create/manage the User Interface (UI) for the telnet client program: client or server? Note: normally, a program would create its own user interface, like PowerPoint writers created a Graphical User Interface (GUI). Some client-server applications offer an option that the server creates and manages the client user interface, such as in web browser/server and telnet client-server systems. Here are the alternatives with advantages (+) and disadvantages (-) Client + No need to transmit UI over the network. Any UI modification may require modification on all clients. Must have access to telnet client source code, or create your own (including managing TCP connections). Server Bandwidth for transmitting UI to each connected client. + Any UI modification requires modification on server only. + Simpler client. Choice: Server (for our app, the UI is not many bytes (simple text based UI), and so the required bandwidth is minimal) 16

What functions or capabilities should the UI provide? These are the requirements of the UI. Note: a requirement describes WHAT the system should do, while design is HOW the system implements a requirement. For example: Requirements: The client interface shall allow a user to input a command to rotate the LEDs to the left. (This is what the system should do.) The delay between shining each LED should be about 1s. (what to do.) Design The system uses a text based user interface, in which the 1 key causes the server to rotate the LEDs in the left direction. (How the system does the requirement.) A software delay function is used to implement the delay between switching LEDs on/off. (How the system does the requirement.) 17

Difference Between Requirements and Design Note: The requirement that states The client interface shall allow a user to input a command to rotate the LEDs to the left, does not specify how the software should implement this requirement: For examples: the implementation could be by: Voice command Graphical user interface menu item Command line interface text based command The command could be by typing rotate LEDs Left on the command line interface The command could be by typing 1 on the command line interface This provides flexibility to the designers. However, the chosen method must satisfy the requirement. 18

What are the Requirements? Homework 19

C Strings For Writing Control Codes Note: since our designs will be that the server will send the UI to the client, we need to write C source code on the server to send the UI to the client. When you use C s string functions, the arguments (i.e., the strings) will be formatted in ASCII. For example, 1 is sent as 0x31. This is fine for sending text messages, but we need to send the escape code, which should not be encoded in ASCII, and other formatting codes, encoded in ASCII, to the VT100 terminal. Consider the C-string: \x1b[2j \x1b[2j \x is the C-escape-x: \x informs the C-compiler that the following string 1B[2J should be interpreted as a Hex encoded byte, until a non-hex symbol, is encountered. At that point the remaining part of the string will be encoded in ASCII. \x1b[2j will be encoded as: 1B5B324A, where 1B is the Hex encoded byte of 1B, and 5B, 32, and 4A are the ASCII codes for [, 2, and J, respectively. Note that the [ character is the first non-hex symbol in the string, so 1B will be encoded as a Hex byte. 1B Hex code for escape: informs the terminal that the following is not a string to display, but it is a control code [2J 5B324A = Control code for Clear Screen 20

Menu 21

After user types 1 After user types d After user types s 22

case SM_DISPLAY_MENU: // Display the menu if(!tcpisconnected(mysocket)) return; int size=sizeof("\x1b[2j \x1b[37m \x1b[1m LED SERVER MENU\n\r1: Put your menu items and control codes here"); if((tcpisputready(mysocket)) < size) return; TCPPutArray(MySocket, (BYTE*)"\x1B[2J \x1b[37m \x1b[1m LED SERVER MENU\n\r1: Put your menu items and control codes here ", size); TCPFlush(MySocket); TCPServerState = SM_PROCESS; break; 23