report on tcp server

Upload: shobhit-sharma

Post on 28-Feb-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/25/2019 Report on Tcp Server

    1/30

    ORGANIZATIONAL

    PROFILE

    INSTRUMENTS RESEARCH & DEVELOPMENT

    ESTABLISHMENT (IRDE)

    DEHRADUN

    A

    Part Of

    1

  • 7/25/2019 Report on Tcp Server

    2/30

    DEFENCE RESEARCH & DEVELOPMENT

    ORGANIZATION (DRDO)

    2

  • 7/25/2019 Report on Tcp Server

    3/30

    1.1 ABOUT IRDE ABOUT IRDE

    Brief Historical Backgro!"

    The origin of IN#TRU$ENT# RE#EAR%H AND DE&ELOP$ENT

    E#TABLI#H$ENT 'IRDE(dates back to the establishment of Inspectorate of

    Scientific Stores in 1)*)at Ra+al,i!"i(Now in Pakistan) with the responsibility

    to inspect Telecommunication equipment used by the Army This had the role of

    At-orit for Hol"i!g #eal Particlars 'AH#P(.This AS!P underwent many

    organi"ational changes until it took a shape of Tec-!ical De/elo,0e!t

    Estalis-0e!t (Instruments and #lectronics) co$ering both R2D a!" AH#P

    functions in fields of instruments during the subsequent years% shed some of its&' and A!SP responsibilities and came into eistence in its present form in

    Ferar 1)34.

    Instruments &esearch ' e$elopment #stablishment (I)% ehradun is a

    pioneering institution de$oted to research% design% de$elopment and technology

    transfer in the fields of sophisticated optical and electro*optical Instruments of $ital

    interest to the efense Situated on the foothills of the great !imalayas% it houses

    some of country+s best talents

    Its primary role is to design% de$elop and pro$ide guideline for indigenous

    manufacturing of modern and sophisticated equipment with the sole ob,ecti$e of

    moderni"ing all three wings of efense Ser$ices

    3

  • 7/25/2019 Report on Tcp Server

    4/30

    1.5 AREA# OF 6OR7

    &esearch% design and de$elopment in the fields of optical% electro*optical

    and optronic instrumentation of sur$eillance% reconnaissance% piloting%

    na$igation guidance% target identification and acquisition% weapon aiming%

    designation% ranging and counter measures under all weather conditions

    during day and night

    esign and de$elopment of complete fire control systems and de$ices Applied and background research and de$elopment in applied optics

    -reation and maintenance of facilities for parametric measurement

    performance and en$ironment e$aluators of optical and electro optical

    components.systems

    Transfer of technology to public to pri$ate sectors% -onsultancy of optical

    and electro*optical instruments% components and materials

    4

  • 7/25/2019 Report on Tcp Server

    5/30

    1.* PRE#ENT #%ENARIO

    This establishment is at present de$oted towards the design and de$elopment of

    equipment in the following areas

    / 0ptical instrument

    1 Night $ision de$ices

    2 3aser based instruments

    4 Stabili"ation of systems

    5 Thermal imaging system

    6 Integrated fire control system

    7 8iber optics

    9 :icro controller% :icroprocessor and 8P;A based systems

    I has also de$eloped a large number of 0pto*:edical instruments

    Speciali"ed groups ha$e been created in the organi"ation that are de$oted

    towards &esearch and e$elopment of instruments belonging to different areas

    like 8iber optics% Imaging% &anging% 8ire control application and Tracking etc

    Apart from the usual &' work% the organi"ation has also under taken the

    in$estigation of ma,or defects eisting instruments% suggest solutions and carry out

    ma,or modification if needed The establishment has also been assisting the Armed

    8orces in the e$olution of foreign equipments

    At the international le$el it maintains liaison with bodies like 0ptical Society of

    America% International Society for 0ptical #ngineering% and Institute of #lectricaland #lectronics #ngineers (I###)

    5

  • 7/25/2019 Report on Tcp Server

    6/30

    1.8 BALLI#TI% %O$PUTER DI&I#ION

  • 7/25/2019 Report on Tcp Server

    7/30

    %lie!t9#er/er

    In -omputer science client*ser$er is a software architecture model

    consisting of two parts% client systems and ser$er systems% both

    communicating o$er a computer network or on the same computer A

    client*ser$er application is a distributed system made up of both client

    and ser$er software The client process always initiates a connection to

    the ser$er% while the ser$er process always waits for requests from any

    client =hen both the client process and ser$er process are running onthe same computer% this is called a single seat setup

    Another type of related software architecture is known as peer*to*peer%

    because each host or application instance can simultaneously act as both

    a client and a ser$er (unlike centrali"ed ser$ers of the client*ser$er

    model) and because each has equi$alent responsibilities and status Peer*

    to*peer architectures are often abbre$iated using the acronym P1P

    The client*ser$er relationship describes the relation between the client

    and how it makes a ser$ice request to the ser$er% and how the ser$er can

    accept these requests% process them% and return the requested information

    to the client The interaction between client and ser$er is often described

    using sequence diagrams Sequence diagrams are standardi"ed in the

    >nified :odeling 3anguage

  • 7/25/2019 Report on Tcp Server

    8/30

    The client*ser$er architecture has become one of the basic models of

    network computing :any types of applications ha$e been written using

    the client*ser$er model Standard networked functions such as #*mailechange% web access and database access% are based on the client*ser$er

    model 8or eample% a web browser is a client program at the user

    computer that may access information at any web ser$er in the world

    A one ser$er based network

    8

  • 7/25/2019 Report on Tcp Server

    9/30

    A peer-to-peerbased network.

    5.1 %lie!ts %-aracteristics Always initiates requests to ser$ers

    =aits for replies

    &ecei$es replies

    >sually connects to a small number of ser$ers at one time

    >sually interacts directly with end*users using any user interface

    such as graphical user interface

    5.5 #er/er %-aracteristics

    Always wait for a request from one of the clients

    Ser$e clients requests then replies with requested data to the

    clients

    A ser$er may communicate with other ser$ers in order to ser$e a

    client request

    A ser$er is a source which sends request to client to get

    needed data of users

    9

  • 7/25/2019 Report on Tcp Server

    10/30

    %lie!t A!" #er/er %o00!icatio!

    In general% a ser$ice is an abstraction of computer resources and a client

    does not ha$e to be concerned with how the ser$er performs while

    fulfilling the request and deli$ering the response The client only has to

    understand the response based on the well*known application protocol%

    ie the content and the formatting of the data for the requested ser$ice

    -lients and ser$ers echange messages in a request@response messaging

    pattern? The client sends a request% and the ser$er returns a response

    This echange of messages is an eample of inter*process

    communication To communicate% the computers must ha$e a common

    language% and they must follow rules so that both the client and the

    ser$er know what to epect The language and rules of communicationare defined in a communications protocol All client*ser$er protocols

    operate in the application layer The application*layer protocol defines

    the basic patterns of the dialogue To formali"e the data echange e$en

    further% the ser$er may implement an API (such as a web ser$ice) The

    API is an abstraction layer for such resources as databases and custom

    software

  • 7/25/2019 Report on Tcp Server

    11/30

    tasks at any moment% it relies on a scheduling system to prioriti"e

    incoming requests from clients in order to accommodate them all in turn

    To pre$ent abuse and maimi"e uptime% the ser$ers software limits how

    a client can use the ser$ers resources #$en so% a ser$er is not immunefrom abuse A denial of ser$ice attack eploits a ser$ers obligation to

    process requests by bombarding it with requests incessantly This

    inhibits the ser$ers ability to respond to legitimate requests

    11

  • 7/25/2019 Report on Tcp Server

    12/30

    8.1 T%P #ER&ER

    INTRODU%TION

    The Transmission -ontrol Protocol (T-P) is a core protocol of the

    Internet Protocol Suite It originated in the initial network

    implementation in which it complemented the Internet Protocol (IP)

    Therefore% the entire suite is commonly referred to as T-P.IP T-P

    pro$ides reliable% ordered% and error*checked deli$ery of a stream of

    octets between applications running on hosts communicating o$er an IP

    network T-P is the protocol that ma,or Internet applications such as the

    =orld =ide =eb% email% remote administration and file transfer rely on

    Applications that do not require reliable data stream ser$ice may use the

    >ser atagram Protocol (>P)% which pro$ides a connectionless

    datagram ser$ice that emphasi"es reduced latency o$er reliability.

    8.5 Net+ork F!ctio!

    The Transmission -ontrol Protocol pro$ides a communication ser$ice at

    an intermediate le$el between an application program and the Internet

    Protocol It pro$ides host*to*host connecti$ity at the Transport 3ayer of

    the Internet model An application does not need to know the particular

    mechanisms for sending data $ia a link to another host% such as the

    required packet fragmentation on the transmission medium At the

    transport layer% the protocol handles all handshaking and transmission

    12

  • 7/25/2019 Report on Tcp Server

    13/30

    details and presents an abstraction of the network connection to the

    application

    At the lower le$els of the protocol stack% due to network congestion%

    traffic load balancing% or other unpredictable network beha$ior% IP

    packets may be lost% duplicated% or deli$ered out of order T-P detects

    these problems% requests retransmission of lost data% rearranges out*of*

    order data% and e$en helps minimi"e network congestion to reduce the

    occurrence of the other problems If the data still remains undeli$ered%

    its source is notified of this failure 0nce the T-P recei$er has

    reassembled the sequence of octets originally transmitted% it passes them

    to the recei$ing application Thus% T-P abstracts the applications

    communication from the underlying networking details

    T-P is utili"ed etensi$ely by many popular applications carried on the

    Internet% including the =orld =ide =eb (===)% #*mail% 8ile Transfer

    Protocol% Secure Shell% peer*to*peer file sharing% and many streamingmedia applications

    T-P is optimi"ed for accurate deli$ery rather than timely deli$ery% and

    therefore% T-P sometimes incurs relati$ely long delays (on the order of

    seconds) while waiting for out*of*order messages or retransmissions of

    lost messages It is not particularly suitable for real*time applicationssuch as Boice o$er IP 8or such applications% protocols like the &eal*time

    Transport Protocol (&TP) running o$er the >ser atagram Protocol

    (>P) are usually recommended instead

    13

  • 7/25/2019 Report on Tcp Server

    14/30

    T-P is a reliable stream deli$ery ser$ice that guarantees that all bytes

    recei$ed will be identical with bytes sent and in the correct order Since

    packet transfer o$er many networks is not reliable% a technique known as

    positi$e acknowledgment with retransmission is used to guaranteereliability of packet transfers This fundamental technique requires the

    recei$er to respond with an acknowledgment message as it recei$es the

    data The sender keeps a record of each packet it sends The sender also

    maintains a timer from when the packet was sent% and retransmits a

    packet if the timer epires before the message has been acknowledged

    The timer is needed in case a packet gets lost or corrupted

    =hile IP handles actual deli$ery of the data% T-P keeps track of the

    indi$idual units of data transmission% called segments% that a message is

    di$ided into for efficient routing through the network 8or eample%

    when an !T:3 file is sent from a web ser$er% the T-P software layer of

    that ser$er di$ides the sequence of octets of the file into segments and

    forwards them indi$idually to the IP software layer (Internet 3ayer) The

    Internet 3ayer encapsulates each T-P segment into an IP packet by

    adding a header that includes (among other data) the destination IP

    address =hen the client program on the destination computer recei$es

    them% the T-P layer (Transport 3ayer) reassembles the indi$idual

    segments and ensures they are correctly ordered and error free as it

    streams them to an application

    14

  • 7/25/2019 Report on Tcp Server

    15/30

    TCP communication

    Basic Flo+c-art Of Tc, %o00!icatio!

    15

  • 7/25/2019 Report on Tcp Server

    16/30

    INTRODU%TION OF

    PRO:E%T

    ;.1 AB#TRA%T

    The Pro,ect C%lie!t #er/er %-at Usi!g

  • 7/25/2019 Report on Tcp Server

    17/30

    ;.5;.5 OB:E%TI&EOB:E%TI&E

    The ob,ecti$e of this pro,ect named C%lie!t #er/er %-at Usi!g

  • 7/25/2019 Report on Tcp Server

    18/30

    ;.*

  • 7/25/2019 Report on Tcp Server

    19/30

    rapid application de$elopment for mobile de$ices became possible%

    although logic can be written with nati$e code as well to achie$e the best

    possible performance Et can be used in se$eral other programming

    languages $ia language bindings It runs on the ma,or desktop platformsand some of the mobile platforms It has etensi$e internationali"ation

    support Non*;>I features include SE3 database access% :3 parsing%

    HS0N parsing% thread management and network support

    19

  • 7/25/2019 Report on Tcp Server

    20/30

    #oft+are Arc-itectre

    Et% when it was first released% relied on a few key concepts?

    %o0,lete astractio! of t-e GUI@ =hen first released% Et used its

    own paint engine and controls% emulating the look of the different

    platforms it runs on when it drew its widgets This made the porting

    work easier because $ery few classes in Et depended really on the target

    platformF howe$er% this occasionally led to slight discrepancies where

    that emulation was imperfect &ecent $ersions of Et use the nati$e style

    APIs of the different platforms% on platforms that ha$e a nati$e widgetset% to query metrics and draw most controls% and do not suffer from

    such issues as much0n some platforms (such as :ee;o and J#) Et is

    the nati$e API Some other portable graphical toolkits ha$e made

    different design decisionsF for eample% w=idgets uses the toolkits of

    the target platform for its implementations

    #ig!als a!" slots @ a language construct introduced in Et for

    communication between ob,ects which makes it easy to implement the

    0bser$er pattern while a$oiding boilerplate code The concept is that

    ;>I widgets can send signals containing e$ent information which can

    be recei$ed by other controls using special functions known as slots

    $etao>ect co0,iler@ The metaob,ect compiler% termed moc% is a tool

    that is run on the sources of a Et program It interprets certain macros

    from the -GG code as annotations% and uses them to generate added -GG

    code with :eta Information about the classes used in the program This

    :eta information is used by Et to pro$ide programming features nota$ailable nati$ely in -GG? signals and slots% introspection and

    asynchronous function calls

    20

  • 7/25/2019 Report on Tcp Server

    21/30

    ReleasesI designing in Et -reator using embedded Et esigner

    21

  • 7/25/2019 Report on Tcp Server

    22/30

    8.8 HARD6ARE

    2#OFT6ARERE

  • 7/25/2019 Report on Tcp Server

    23/30

    8.; $ODULE DE#%RIPTION

    Detaile" "escri,tio! of t-e 0o"les?

    The ETcpSer$er class pro$ides a T-P*based ser$er

    This class makes it possible to accept incoming T-P connections =e

    can specify the port or ha$e ETcpSer$er pick one automatically =e can

    listen on a specific address or on all the machines addresses

    liste!'( ?to ha$e the ser$er listen for incoming connections

    !e+%o!!ectio!'( ? the signal is then emitted each time a clientconnects to the ser$er

    %all !e@tPe!"i!g%o!!ectio!'( ?to accept the pending connection as a

    connected ETcpSocket The function returns a pointer to a ETcpSocket

    in

  • 7/25/2019 Report on Tcp Server

    24/30

    If an error occurs% ser/erError'(returns the type of error% and

    error#tri!g'(can be called to get a human readable description of what

    happened

    =hen listening for connections% the address and port on which the ser$er

    is listening are a$ailable as ser/erA""ress'(and ser/erPort'(.

    %alli!g close'(makes ETcpSer$er stop listening for incoming

    connections Although ETcpSer$er is mostly designed for use with an

    e$ent loop% its possible to use it without one In that case% you must use

    +aitForNe+%o!!ectio!'(?which blocks until either a connection is

    a$ailable or a timeout epires.

  • 7/25/2019 Report on Tcp Server

    25/30

    8.3 #%REEN #HOT#

    First, we need to add network module to our project file,

    MultiThreadedQTcpServer.pro:

    QT += core

    QT += network

    QT -= gui

    TARGET = MultiThreadedQTcpServer

    CO!"G += con#ole

    CO!"G -= app$%undle

    TEM&'ATE = app

    SO(RCES += )ain*cpp

    Then, we want to create a new class called MyServer.

    25

  • 7/25/2019 Report on Tcp Server

    26/30

    Another class called :yThread should be created as well

    26

  • 7/25/2019 Report on Tcp Server

    27/30

    R! t-e co"e?

    Then we get the result as in the picture below saying the ser$er is

    listening?

    Then% open up another cmd window% and send a connection request $ia

    telnet?

    27

  • 7/25/2019 Report on Tcp Server

    28/30

    The picture below shows the two responses from two different clients

    connection requests?

    28

  • 7/25/2019 Report on Tcp Server

    29/30

    8.3 FUTURE #%OPE

    The software uses the Et console application%in future it can be mad using

    the ;>I process

    Since%chatting is most common these days in sharing pictures%files%$ideo

    etcIn future this software can be used to transfer pictures%files%$ideo etc

    29

  • 7/25/2019 Report on Tcp Server

    30/30

    REFEREN%E#

    M/Section 1/ https?..enwikipediaorg.wiki.tcpser$er

    M/ Section 11%12%14https?..wwwsilabscom

    M1Section 2/https?..enwikipediaorg

    M1Section 21wwwtrimblecom.tcpOtutorials.whatgpsasp

    M1Section 22wwwthecon$ersationcom.eplainer*what*is*tcp*/1149

    https://en.wikipedia.org/wiki/tcphttps://www.silabs.com/http://www.trimble.com/tcp_tutorials/whatgps.aspxhttp://www.theconversation.com/explainer-what-is-tcp-12248https://www.silabs.com/http://www.trimble.com/tcp_tutorials/whatgps.aspxhttp://www.theconversation.com/explainer-what-is-tcp-12248https://en.wikipedia.org/wiki/tcp