Saturday, 19 July 2014

Simple and Basic Understanding of HTTP

INTRODUCTION: 


HTTP stands for  Hyper text transfer protocol .Before i will go into Http , let me explain what is protocol? In computer world protocol it is more or less like the manners or rule how computer layers or components interact with each other.When visiting Web sites, the client application makes connections to Web servers via a network protocol called HTTP. These network connections support sending response data from servers back to clients including the content of Web pages and also some protocol control information. 

EXPLANATION  

There is big/complex model made of 7 layers known as OSI Model as shown below



HTTP is just a small piece this model. So, lets what each word denotes in HTTP  acronym. The T and the P together are the transfer protocol and HT, or hypertext, is the something that gets transferred with this protocol. Being more specific about hypertext, it is just when you create webpage and put come links for connecting/jump from one page to another. So, this hypertext needs to fallow some convention or rules.On the other side of the network we essentially have nothing more than your computer but instead of a browser with another piece of software, a web server. Of course, that computer also has HTTP installed. Here the protocol is linked with this web server software which will get the request and according to it will answer with a response. This response, again according to the rules set in the protocol, will be send back to your computer where the browser will understand what is going on and present the response to you. 

 HTTP (Hypertext Transfer Protocol) is the most popular application protocol used in the Internet

HTTP is an asymmetric request-response client-server protocol .  An HTTP client sends a request message to an HTTP server.  The server, in turn, returns a response message.  

HTTP is a stateless protocol means the current request does not know what has been done in the previous requests.
 



Whenever you issue a URL from your browser to get a web resource using HTTP, e.g. http://www.shabirhakim.net/index.html, the browser turns the URL into a request message and sends it to the HTTP server. The HTTP server interprets the request message, and returns back you an appropriate response message, which is either the resource you requested or an error message. This process is illustrated below:



Uniform Resource Locator (URL)

A URL (Uniform Resource Locator) is used to uniquely identify a resource over the web. URL has the following syntax:

protocol://hostname:port/path-and-file-name
There are 4 parts in a URL:

  1. Protocol: The application-level protocol used by the client and server, e.g., HTTP, FTP, and telnet.
  2. Hostname: The DNS domain name (e.g., www.shabirhakim.net) or IP address (e.g., 192.128.1.2) of the server.
  3. Port: The TCP port number that the server is listening for incoming requests from the clients.
  4. Path-and-file-name: The name and location of the requested resource, under the server document base directory.
NOTE:HTTP is a client-server application-level protocol. It typically runs over a TCP/IP connection, as illustrated above. 

HTTP Request Methods

HTTP protocol defines a set of request methods. A client can use one of these request methods to send a request message to an HTTP server. The methods are:

GET: A client can use the GET request to get a web resource from the server.
HEAD: A client can use the HEAD request to get the header that a GET request would have obtained. Since the header contains the last-modified date of the data, this can be used to check against the local cache copy.
POST: Used to post data up to the web server.
PUT: Ask the server to store the data.
DELETE: Ask the server to delete the data.
TRACE: Ask the server to return a diagnostic trace of the actions it takes.
OPTIONS: Ask the server to return the list of request methods it supports.
CONNECT: Used to tell a proxy to make a connection to another host and simply reply the content, without attempting to parse or cache it. This is often used to make SSL connection through the proxy.


Response Status Code

The first line of the response message (status line) contains the response status code, which is generated by the server to indicate the result of the request.

The status code is a 3-digit number:

 1xx (Informational): Request received, server is continuing the process.
  2xx (Success): The request was successfully received, understood, accepted and serviced.
  3xx (Redirection): Further action must be taken in order to complete the request.
  4xx (Client Error): The request contains bad syntax or cannot be understood.
  5xx (Server Error): The server failed to fulfill an apparently valid request.


COMMONLY ENCOUNTERED STATUS CODE:
100 Continue: The server received the request and in the process of giving the response.
200 OK: The request is fulfilled.
301 Move Permanently: The resource requested for has been permanently moved to a new location. The URL of the new location is given in the response header called Location. The client should issue a new request to the new location. Application should update all references to this new location.
302 Found & Redirect (or Move Temporarily): Same as 301, but the new location is temporarily in nature. The client should issue a new request, but applications need not update the references.
304 Not Modified: In response to the If-Modified-Since conditional GET request, the server notifies that the resource requested has not been modified.
400 Bad Request: Server could not interpret or understand the request, probably syntax error in the request message.
401 Authentication Required: The requested resource is protected, and require client’s credential (username/password). The client should re-submit the request with his credential (username/password).
403 Forbidden: Server refuses to supply the resource, regardless of identity of client.
404 Not Found: The requested resource cannot be found in the server.
405 Method Not Allowed: The request method used, e.g., POST, PUT, DELETE, is a valid method. However, the server does not allow that method for the resource requested.
408 Request Timeout:
414 Request URI too Large:
500 Internal Server Error: Server is confused, often caused by an error in the server-side program responding to the request.
501 Method Not Implemented: The request method used is invalid (could be caused by a typing error, e.g., "GET" misspell as "Get").
502 Bad Gateway: Proxy or Gateway indicates that it receives a bad response from the upstream server.
503 Service Unavailable: Server cannot response due to overloading or maintenance. The client can try again later.
504 Gateway Timeout: Proxy or Gateway indicates that it receives a timeout from an upstream server.

Finally , 
CONCLUSION : 
HTTP is an application-level protocol for distributed, collaborative, hypermedia information systems. It is a generic, stateless, protocol which can be used for many tasks beyond its use for hypertext, such as name servers and distributed object management systems, through extension of its request methods, error codes and headers. A feature of HTTP is the typing and negotiation of data representation, allowing systems to be built independently of the data being transferred

PROTOCOLS WITH RESPECTIVE FAMILIES


Protocol Family
(ISO8073)
A1
A10
A11
A12
A13
A14
A15
A3
A7
A8
A9
AAL2(Offline)
AARP
Abis
Abis
ACSE
ADSP
AEP
AFP
AH
AH
AMR
AppleArp
AppleTalk
ARP/RARP
ASP
ATCP
ATMCell(AAL0-AAL5)
ATMCellNNI
ATMCellUNI
ATMCircuitEmulation
ATMP
ATMSAR
ATP
AVAYA(Skinny)
BACP
Banyan
BAP
BCAST
BCC
BCC
BCP
BGMP
BGP-4
BICC
B-ICI
B-ISUP
BMC
BMP
BPDU
BSD
BSMAP
BSSAP
BSSAP+
BSSAP+
BSSGP
BSSMAP
BTSM
BTSM/LAPD
BVCP
CAMEL
CAMEL
Cascade
CC
CC
CC
CCP
CDP
CHAP
CIF
CiscoISL
CiscoRouter
CiscoSRB
CMIP
COPS
CTERM
DAP
DCAP
DDP
DEC_LANBridge
DEC_LAT
DEC_LAVC
DEC_MOP_D/L
DEC_MOP_RC
DEC_Route
DESE
DHCP
DHCPv6
DIAG
DIS
DISL
DLSw
DNCP
DNS
DriP
DSMCC
DTAP
DUP
DVB
DVMRP
EAP
ECP
EGP
EIGRP
ELCP
ES-IS
ESP
ESP
Ethernet
EtherTalk
FANP
FDDI
Finger
FP
FrameRelay
FrameRelayOverATM
FrameRelayOverLAPF
FrameRelayOverLLC
FrameRelayOverSNA
FRF.9(DCP)
FRF10
FRF11
FRF12
FRF16
FRF4
FRF5
FRF8
FTAM
FTP
FUNI
G711
G723.1
G729
GARP
GCC
GCC
GCP
GMM/SM
GMM/SM
GMRP
GOPHER
GR-303(IDLC/LAPD)
GRE
GSMP
GTP
GTP
GTP'
GVRP
H.225
H.235
H.245
H.261
H.263
H.450.1
H.450.10
H.450.11
H.450.12
H.450.2
H.450.3
H.450.4
H.450.5
H.450.6
H.450.7
H.450.8
H.450.9
H225G
H225G
HDLC
HPR-APPN
HSRP
HTTP
ICMP
ICMPv6
ICP
ICPv2
IDLC
IDP
IDRP
IDRP
IFMP
IGMP
IGRP
IISP
ILMI
IMAP4
IMPP
INAP
IP
IPARSEoverX.25overLAPB
IPC
IPCP
IPDC
IPOverATM
IPOverHDLC
IPv6
IPv6CP
IPX
IPXCP
IRC
ISAKMP/IKE
ISDN
IS-IS
ISL
ISO-IP(CLNP)
ISOoverX.25
ISO-PP
ISO-SP
ISO-TP
ISUP
ITUQ2931
ITUQ2971
IuUP
L2F
L2TP
LAPB
LAPD
LAPF
LAPV5
LAPV5DL
LAT
LAVC
LCP
LDAP
LDP
LE802.3
LE802.5
LEControl
LES(PSTN)
LEX
LEXCP
LLC
LLC
LQR
LZS
M2PA
M2UA
M3UA
MAC
MAP
MAP
MAPOS
MARS
MDLP
MDTP
Megaco(ASCII+ASN.1)
Megaco(H.248)
MegacooverATM
MGCP
MLP
MM
MM
MM
MMS
MNRP
MNTv1
MobileIP
MOP
MOUNT
MPEG-2
MPLS
MPLSoverATM
MPPC
MTP-2
MTP-3
MTP3B
MultiPPP
MZAP
NARP
NBAP
NBFCP
NBP
NCP
NDS
NetBIOS
NetBIOS/IP
NetRPC
NFS
NHDR
NHRP
NHRP
NLM
NLP
NLSP
NNIPVC
NNISVC
NovelNetBIOS
NS
NSM
NSP
NSP
NTP
O&M
OSINLCP
OSPF
PAP
PAP
PDCP
PEP
PIM
PMAP
PNNIRouting
PNNISignaling
POP3
PPP
PPP-BPDU
PPPMultilink
PPPoE
PPPoverATM
PPPoverHDLC
PPPoverLAPB
PPPoverLAPF
PPTP
Proteon
PROXY(Skinny)
Q.2140
Q.2140
Q.SAAL
Q2630
QLLC
Radius
RANAP
RAS
Rexec
RIP
RIP2
RIPngforIPv6
RIPX
RLC
RLC/MAC
Rlogin
RLP
RLP
RND
RNSAP
ROSE
RP
RPC
RPCB
RPCB
Rprint
RR
RR
RR
RRC
Rshell
RSVP
RTCP
RTMP
RTP
RTP
RTSP
RUDP
RVPoverIP
Rwho
SAMOverFREther
SAMOverX.25OverLAPB
SAP
SAPv2
SCCP
SCP
SCSP
SCTP
SCTP
SDCP
SDCP
SDLC
SDP
SER
SGCP
SIP
SIP-L3
Skinny
SLP
SMB
SMPP
SMS
SMS
SMS
SMS(TP)
SMS(TP)
SMSCB
SMS-CB
SMSCB
SMT
SMTP
SNA
SNA5250
SNACP
SNAoverSDLC
SNAP
SNARH
SNATerminology
SNATH
SNATHO-THS
SNDCP
SNDCP
SNDCP
SNMP
SOCKS
SPANS
SPANS
SPP
SPP
SPX
SRP
SS
SS
SS
SSP
STP
StreetTalk
T.125
T.38
TACACS+
TALI
TCAP
TCP
TDP
TELNET
TFTP
THDR
Timeplex(BRE2)
TokenRing
TOM
TPKT
TRAU
TRIP
TUP
UDP
UNI3.x
UNI4.0
UNISVC
V5
V5-BCC
V5-Control
V5-LinkControl
V5-Protection
V5-PSTN
VanJacobson
VARP
VB51
VIP
VIVIDarm
VIVIDbme
VIVIDccp
ViVIDMPOA
VLAN(802.1Q)
VRRP
VTP
WCCP
WCMP
WDOG
WDP
Wellfleet
WSP
WTLS
WTP
X.25
X.75
XOT
X-Window
YP(NIS)
ZIP
ISO
CDMA2000
CDMA2000
CDMA2000
CDMA2000
CDMA2000
CDMA2000
CDMA2000
CDMA2000
CDMA2000
CDMA2000
CDMA2000
ATM
AppleTalk
Cellular
GPRS
ISO
AppleTalk
AppleTalk
AppleTalk
IPSecurity
TCP/IP
UMTS
AppleTalk
AppleTalk
TCP/IP
AppleTalk
PPP
ATM
ATM
ATM
Audio/VisualOver ATM
TCP/IP
ATM
AppleTalk
VoIP
PPP
Banyan
PPP
Novell
GPRS
UMTS
PPP
TCP/IP
TCP/IP
SS7
ATMSignaling&Routing
ATMSignaling&Routing
UMTS
Novell
Bridge/Router
PPP
Cellular
Cellular
GPRS
UMTS
GPRS
Cellular
Cellular
Cellular
PPP
GPRS
UMTS
FrameRelay
Cellular
GPRS
UMTS
PPP
Bridge/Router
PPP
LANDataLinkLayer
Bridge/Router
Bridge/Router
Bridge/Router
ISO
TCP/IP
DECnet
DECnet
TCP/IP
AppleTalk
DECnet
DECnet
DECnet
DECnet
DECnet
DECnet
PPP
TCP/IP
TCP/IP
Novell
LANDataLinkLayer
Bridge/Router
IBM
PPP
TCP/IP
Bridge/Router
Audio/VisualOverATM
Cellular
SS7
Audio/VisualOverATM
TCP/IP
PPP
PPP
TCP/IP
TCP/IP
VoDSL
ISO
IPSecurity
TCP/IP
LANDataLinkLayer
AppleTalk
TCP/IP
LANDataLinkLayer
TCP/IP
UMTS
FrameRelay
FrameRelay
FrameRelay
FrameRelay
FrameRelay
FrameRelay
FrameRelay
FrameRelay
FrameRelay
FrameRelay
FrameRelay
FrameRelay
FrameRelay
ISO
TCP/IP
FUNI
VoIP
VoIP
VoIP
LANDataLinkLayer
GPRS
UMTS
UMTS
GPRS
UMTS
LANDataLinkLayer
TCP/IP
GR-303
TCP/IP
IPSwitching
GPRS
UMTS
UMTS
LANDataLinkLayer
H.323
H.323
H.323
H.323
H.323
H.323
H.323
H.323
H.323
H.323
H.323
H.323
H.323
H.323
H.323
H.323
H.323
H.323
H.323
X.25
IBM
TCP/IP
TCP/IP
TCP/IP
TCP/IP
TCP/IP
TCP/IP
GR-303
XNS
ISO
TCP/IP
IPSwitching
TCP/IP
TCP/IP
ATMSignaling&Routing
ILMI
TCP/IP
TCP/IP
SS7
TCP/IP
X.25
Banyan
PPP
TCP/IP
ATM
X.25
TCP/IP
PPP
Novell
PPP
TCP/IP
IPSecurity
ISDN
ISO
TagSwitchingr
ISO
ISO
ISO
ISO
ISO
SS7
ATMSignaling&Routing
ATMSignaling&Routing
UMTS
TCP/IP
TCP/IP
X.25
ISDN
FrameRelay
V5.1/V5.2
VoDSL
DECnet
DECnet
PPP
TCP/IP
TCP/IP
LANEmulation
LANEmulation
LANEmulation
VoDSL
PPP
PPP
GPRS
LANDataLinkLayer
PPP
PPP
Sigtran
Sigtran
Sigtran
UMTS
GPRS
UMTS
Bridge/Router
TCP/IP
CDPD
TCP/IP
TCP/IP
VoIP
VoIP
VoIP
X.25
Cellular
GPRS
UMTS
Cellular
CDPD
SUN
TCP/IP
DECnet
SUN
Audio/VisualOverATM
TagSwitchingr
TagSwitchingr
PPP
SS7
SS7
UMTS
PPP
TCP/IP
TCP/IP
UMTS
PPP
AppleTalk
Novell
Novell
IBM
TCP/IP
Banyan
SUN
IBM
IBM
TCP/IP
SUN
IBM
Novell
FrameRelay
FrameRelay
Novell
GPRS
SUN
Bridge/Router
DECnet
TCP/IP
Cellular
PPP
TCP/IP
AppleTalk
PPP
UMTS
XNS
TCP/IP
SUN
ATMSignaling&Routing
ATMSignaling&Routing
TCP/IP
PPP
PPP
PPP
PPP
PPP
PPP
PPP
PPP
TCP/IP
Bridge/Router
VoIP
ATMSignaling&Routing
SS7
ATMSignaling&Routing
UMTS
IBM
TCP/IP
UMTS
H.323
UNIX
XNS
TCP/IP
TCP/IP
Novell
UMTS
GPRS
UNIX
Cellular
UMTS
Bridge/Router
UMTS
ISO
DECnet
SUN
SUN
SUN
UNIX
Cellular
GPRS
UMTS
UMTS
UNIX
TCP/IP
H.323
AppleTalk
Banyan
H.323
TCP/IP
TCP/IP
VoIP
UNIX
FrameRelay
X.25
Novell
VoIP
SS7
DECnet
TCP/IP
Sigtran
TCP/IP
PPP
TCP/IP
IBM
VoIP
Novell
VoIP
VoIP
SMDS
VoIP
TCP/IP
IBM
TCP/IP
Cellular
GPRS
UMTS
GPRS
UMTS
Cellular
GPRS
UMTS
LANDataLinkLayer
TCP/IP
IBM
IBM
PPP
IBM
LANDataLinkLayer
IBM
IBM
IBM
IBM
CDPD
GPRS
UMTS
TCP/IP
TCP/IP
ATMSignaling&Routing
ATMSignaling&Routing
Banyan
XNS
Novell
LANDataLinkLayer
Cellular
GPRS
UMTS
Bridge/Router
DECnet
Banyan
H.323
H.323
TCP/IP
Sigtran
SS7
TCP/IP
TagSwitchingr
TCP/IP
TCP/IP
IBM
FrameRelay
LANDataLinkLayer
GPRS
H.323
Cellular
TCP/IP
SS7
TCP/IP
ATMSignaling&Routing
ATMSignaling&Routing
FrameRelay
V5.1/V5.2
V5.1/V5.2
V5.1/V5.2
V5.1/V5.2
V5.1/V5.2
V5.1/V5.2
TCP/IP
Banyan
VB51
Banyan
VIVID
VIVID
VIVID
ATMSignaling&Routing
LANDataLinkLayer
TCP/IP
Bridge/Router
TCP/IP
WAP
Novell
WAP
Bridge/Router
WAP
WAP
WAP
X.25
X.25
TCP/IP
TCP/IP
SUN
AppleTalk
AppleTalk AppleArp, AppleTalk, EtherTalk, AARP, ADSP, AEP, AFP, ASP, ATP, DDP, NBP, PAP, RTMP, ZIP
ATM ATM Cell (AAL0-AAL5), ATM Cell NNI, ATM Cell UNI, ATM SAR,
IP Over ATM, AAL2
ATM Signaling & Routing ITU Q2931, ITU Q2971, B-ICI,
B-ISUP, IISP, PNNI Routing,
PNNI Signaling, Q.2140, Q.SAAL, SPANS, UNI 3.x, UNI 4.0,
ViVID MPOA, SPANS
Audio/Visual Over ATM ATM Circuit Emulation, DSMCC,
DVB, MPEG-2
Banyan Banyan, IPC, NetRPC, RTP,
SPP, StreetTalk, VARP, VIP
Bridge/Router BPDU, CDP, Cisco ISL, Cisco HDLC (cHDLC), Cisco SRB, DISL, DRiP, MAPOS, NSP, Proteon, RND, SSP, VTP, Wellfleet
CDMA2000 A1, A3, A7, A8, A9, A10, A11, A12, A13, A14, A15
CDPD MDLP, MNRP, SNDCP
Cellular Abis, BSMAP, BSSAP, BSSMAP,
BTSM, BTSM/LAPD, CC, DTAP, MM, O & M, RR, RLP, SMS, SMSCB, TRAU, MMS, SS
DECnet CTERM, DAP, DEC_LANBridge,
DEC_LAT, DEC_LAVC, DEC_MOP_D/L, DEC_MOP_RC,
DEC_Route, LAT, LAVC, MOP, NSP, RP, SCP, STP
Frame Relay Cascade, Frame Relay, Frame Relay Over ATM, Frame Relay Over LAPF, Frame Relay Over LLC, Frame Relay Over SNA, FRF4, FRF5, FRF8, FRF.9 (DCP),
FRF10, FRF11, FRF12, FRF16, LAPF, NNI PVC, NNI SVC, SAM Over FREther, Timeplex (BRE2),
UNI SVC
FUNI FUNI
GPRS Abis, BCC, BSSAP+, BSSGP,
CAMEL, CC, GCC, GMM/SM, GTP, LLC, MAP, MM, NS, RR, RLC/MAC, SMS, SMS(TP), SMS-CB, SNDCP, SS, TOM
GR-303 IDLC, GR-303 (IDLC/LAPD)
H.323 H.225, H.235, H.245, H.261, H.263, H225G, H.450.1, H.450.10,
H.450.11, H.450.12, H.450.2, H.450.3, H.450.4, H.450.5, H.450.6, H.450.7, H.450.8, H.450.9, H225G, RAS, RTCP, RTP, T.125, T.38, TPKT
IBM DLSw, HPR-APPN, NetBIOS, NHDR, NHRP , NLP, QLLC, SDLC, SMB, SNA, SNA 5250, SNA over SDLC,
SNA Terminology, SNARH, SNATH, SNA THO-THS, THDR
ILMI ILMI
IP Security AH, ESP, ISAKMP/IKE
IP Switching GSMP, IFMP
ISDN ISDN, LAPD
ISO ACSE, CMIP, ES-IS, FTAM, IDRP, IS-IS, ISO-IP (CLNP),
ISO-PP, ISO-SP, ISO-TP,
(ISO 8073), ISO over X.25, ROSE
LAN Data Link Layer CIF, DIS, Ethernet, FDDI,
GARP, GMRP, GVRP, LLC, SMT, SNAP, SRP, Token Ring, VLAN (802.1Q)
LAN Emulation LE 802.3, LE 802.5, LE Control
Novell BCAST, BMP, DIAG, IPX, NCP,
NDS, NLSP, Novel NetBIOS, RIPX, SAP, SER, SPX, WDOG
PPP ATCP, BACP, BAP, BCP, BSD,
BVCP, CCP, CHAP, DESE, DNCP, EAP, ECP, IPCP, IPv6CP, IPXCP, LCP, LEX, LEXCP, LQR, LZS, MPPC, Multi PPP, NBFCP, OSINLCP, PAP, PPP,
PPP Multilink, PPP-BPDU,
PPP over ATM, PPP over LAPB, PPP over LAPF, PPP over HDLC, PPPoE, SDCP, SNACP
Sigtran M2PA, M2UA, M3UA, SCTP, TALI
SMDS SIP-L3
SS7 BICC, DUP, INAP, ISUP, MTP-2,
MTP-3, Q.2140, SCCP, TCAP, TUP
SUN MOUNT, MNTv1, NFS, NLM, NSM, PMAP, RPC, RPCB, RPCB,
YP (NIS)
Tag Switching ISL, MPLS, MPLS over ATM, TDP
TCP/IP AH, ARP/RARP, ATMP, BGMP,
BGP-4, COPS, DCAP, DHCP, DHCPv6, DNS, DVMRP, EGP, EIGRP, ESP, FANP, Finger, FTP, GOPHER, GRE, HSRP, HTTP, ICMP, ICMPv6, ICP, ICPv2, IDRP,
IGMP, IGRP, IMAP4, IMPP, IP, IPv6, IPDC, IRC, L2F, L2TP, LDAP, LDP, MARS, MDTP, Megaco (ASCII + ASN.1),
Mobile IP, MZAP, NARP, NetBIOS/IP, NHRP, NTP, OSPF, PIM, POP3, PPTP, Radius, RIP2, RIPng for IPv6, RSVP, RTSP, RUDP, SCSP, SCTP, SDCP , SLP, SMPP, SMTP, SNMP, SOCKS, TACACS+, TCP, TELNET, TFTP, TRIP, UDP, Van Jacobson, VRRP, WCCP, XOT,
X-Window
UMTS AMR, BCC, BSSAP+, CAMEL, CC, FP, GCC, GMM/SM, GTP, GTP', GCP, MAC, MAP, MM, NBAP, PDCP, Q2630, RANAP, RLC, RLP, RNSAP, RRC, SMS, SMS(TP), SNDCP,IuUP, SMSCB, BMC, MTP3B, RR, SS
UNIX Rexec, Rlogin, Rprint, Rshell,
Rwho
V5.1/V5.2 LAPV5, V5, V5-BCC, V5-Control,
V5-Link Control, V5-Protection, V5-PSTN
VB51
VB51
VIVID
VIVIDarm, VIVIDbme, VIVIDccp
VoDSL
ELCP, LAPV5DL, LES-PSTN, (VoATM)
VoIP AVAYA (Skinny), G729, G723.1, G711, Megaco (H.248),
Megaco over ATM, MGCP, PROXY (Skinny), RVP over IP, SAP v2, SDP, SIP, Skinny, SGCP
WAP WCMP, WDP, WSP, WTLS, WTP
X.25 HDLC, IP Over HDLC,
IPARSE over X.25 over LAPB, LAPB, MLP,
SAM Over X.25 Over LAPB, X.25, X.75
XNS IDP, PEP, RIP, SPP

REFERENCES & RESOURCES

Saturday, 5 July 2014

LINQ ,ENTITY FRAMEWORK,LINQ TO ENTITIES,LINQ TO SQL DIFFERENCE AND SIMILARTIES


Assumptions:

1..NET2.0/4.0 and vs 2005/2008/2010/above is installed on system. 
 Code Download: Click Here to download entire solution
2. Knowledge .Net2.0,3.5 Basics with C#and basic SQL Server
Note : I am using Microsoft vs2013 Express for web application development.You can use visual studio any version starting from 2008

INTRODUCTION

 Actually, I thought of writing this post regarding LINQ ,ENTITY FRAMEWORK..because most of the posts and queries I have seen are regarding these technologies and seems most of the developers are confused with this part of .NET Technology. But trust me LINQ is such a strong language extension which has given great power to .NET languages to query data within application only. LINQ defines a .NET application programming interface (API) and set of extensions to the Visual Basic and C# languages that enables querying diverse data types with a single syntax that ’ s similar to Structured Query Language (SQL) Which we use for database access. 

 LET US UNDERSTAND LINQ FIRST

 What is LINQ?

Language Integrated Query (LINQ) is a set of extensions to the .NET Framework that encompass language-integrated query, set, and transform operations. It extends C# and Visual Basic with native language syntax for queries from object, XML, and databases, and provides class libraries to take advantage of these capabilities. Let us see an example first. Suppose there is a list of integers as follows:

var list = new List<int>() { 1, 2, 3, 4, 5, 6, 100 };

To find all the even numbers in this list, you might write some code as follows:
var firstList= new List<int>();
foreach (var num in list)
{
if (num % 2 == 0)
list1.Add(num);
}
Now with LINQ, you can select all of the even numbers from this list and assign the query result to a variable in just one-sentence expression like this:
var secondList= from number in list
where number % 2 == 0
select number;
In this example, secondList and firstList are equivalent. list2 contains the same numbers as list1 does. As you can see, you don't write a foreach loop. Instead, you write a SQL statement.
But what do from, where, and select mean here? Where are they defined? How and when can they be used? Let us start the exploration now.
Language Integrated Query, or LINQ, is a flexible ,structured simple , SQL-like query language designed to give the programmer consistent syntax to query any data set, whether database, XML, or just plain objects. We can also take it  as It is just developed  for comfort a.
EXAMPLE:
We are going to Query an Object Collection
Scenario/Problem: You want to query a collection for all objects meeting some criteria.
This and the following examples use some data objects to demonstrate how LINQ works.
//class declared and definition Book Antiqua";">
public class Book
{
public string Title { get; set; }
public int AuthorId { get; set; }
public int PublishYear { get; set; }
public Book(string title, int authorId, int year)
{
this.Title = title;
this.AuthorId = authorId;
this.PublishYear = year;
}
public override string ToString()
{
return string.Format(“{0} - {1}”, Title, PublishYear);
}
class Author
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public Author (int id, string firstName, string lastName)
{
this.Id = id;
this.FirstName = firstName;
this.LastName = lastName;
}
}
//...
List<Book> books = new List<Book>{
new Book(“Jack”, 1, 1941),
new Book(“Rack”,1, 1942),
new Book(“Back”,1, 1943),
 };

List authors = new List<Author>
{
new Author(1, “Shabir”, “Hakim”)
};
BASIC LINQ QUERY SHOWN BELOW  RETRIEVES ALL BOOK INFORMATION
 
var allBooks = from book in books select book;
foreach (Book book in allBooks)
{
Console.WriteLine(book.ToString());
}
The var keyword is often used with LINQ for reasons you’ll see later. In this case,
allBooks is a collection of Book objects. The output is as follows:
Jack - 1841
Rack - 1842
Back - 1853  
Before We Understand Entity Framework,we should know why Entity Framework and Why Not Entity Framework?
Entity Framework is an evolution of ADO.NET and is a data access framework comes with .NET 4.0 , Bridges the gap between database and objects(POCO) and sits on top of ADO.NET

When Not to use Framework?

 Code can only access the database through stored procedures. EF does have limited support for SP.
Frequently insert operations  Bulk is not supported yet by EF
Assume we want to work in a method of loading ALL data into memory is that recommended using Entity framework? What problems should we expect?
Loading all entities will require many queries and a lot of time.
Latencies because of the EF change tracking and large collection handling.
EF contexts are not thread-safe, you should not use one context for the entire service.
If you do intend to do that, use EF for loading entities, but not for managing them (detach the entities from the content).
do not use the context as a cache object (for distributed scenarios)
it is not thread safe, having overheads and doesn’t follow the idea of separation of concern. it is much better to use a designated cache API like AppFabric Cache.

Why Entity Framework ?

As LINQ to Entities is part of the Entity Framework, let's now learn what that is.
ADO .NET Entity Framework (EF) is an addition to the Microsoft ADO.NET family. It enables developers to create data access applications by programming against a conceptual application model instead of programming directly against a relational storage schema. The goal is to decrease the amount of code and maintenance required for the data-oriented applications. The Entity Framework applications provide the following benefits:
  • Applications can work in terms of a more application-centric conceptual model including types with inheritance, complex members, and relationships
  • Applications are freed from hard coded dependencies on a particular data engine or storage schema   Mappings between the conceptual model and the storage-specific schema can change without changing the application code  Developers can work with a consistent application object model that can be mapped to various storage schema s, possibly implemented in different database management systems
  • Multiple conceptual models can be mapped to a single storage schema   The Language Integrated Query (LINQ) support provides compile-time syntax validation for queries against a conceptual model
 With Entity Framework, developers work with a conceptual data model, an Entity Data Model (EDM), instead of the underlying databases. 
The conceptual data model schema is expressed in the Conceptual Schema Definition Language (CSDL), 
the actual storage model is expressed in the Storage Schema Definition Language (SSDL),
 and the mapping in between is expressed in the Mapping Schema Language (MSL). 
A new data-access provider, EntityClient, is created for this new framework, but under the hood, the ADO.NET data providers are still being used for communicating with the databases.

OVERHEAD OF USING EF VS ADO.NET

  • The overhead of taking a ado.net data reader an transforming the results to objects, and the overhead of compiling SQL queries from LINQ.
    You will have the same overhead and even more, if you try to build your own ORM framework. Better don't do it
  • When you have abstraction layer you get overhead. The overhead depends on what they do with Entity Framework.
  • in general you should consider to get away from Inheritance because it does have a greater overhead.

 LINQ to Entities

Now let's have a look at what LINQ to Entities is.
LINQ to Entities provides the LINQ support that enables developers to write queries against an Entity Framework conceptual model using Visual Basic or Visual C#. Queries against the Entity Framework are represented by command-tree queries, which execute against the object context. LINQ to Entities converts the LINQ queries to the command-tree queries, executes the queries against Entity Framework, and returns objects that can be used by both Entity Framework and LINQ.
LINQ to Entities allows developers to create flexible, strongly-typed queries against the EDM by using the LINQ expressions and standard LINQ query operators. To a certain degree, LINQ to Entities is similar to LINQ to SQL, but LINQ to Entities is a true ORM  Article from Microsoft and it supports more features than LINQ to SQL, such as multiple-table inheritance. LINQ to Entities also supports many other mainstream RDBMS databases such as Oracle, DB2, and MySQL, in addition to Microsoft SQL Server.

 LINQ TO SQL

Before LINQ to Entities, Microsoft released another ORM  Product, LINQ to SQL. Both LINQ to SQL and LINQ to Entities can be used in the data access layer to interact with databases, but they are quite different. In this section, we will learn what LINQ to SQL is, and in the next section we will compare these two technologies.
In short, LINQ to SQL is a component of the .NET framework that provides a runtime infrastructure for managing relational data as objects.
In LINQ to SQL, the data model of a relational database is mapped to an object model expressed in the programming language of the developer. When the application runs, LINQ to SQL translates the language-integrated queries in the object model into SQL and sends them to the database for execution. When the database returns the results, LINQ to SQL translates the results back to objects that you can work with in your own programming language.
Unlike LINQ to Entities, with LINQ to SQL developers don't need to create an extra data model between their applications and the underlying database. Under the hood of LINQ to SQL, the ADO.NET SqlClient adapters are used to communicate with the actual SQL Server databases.
The following diagram shows the use of LINQ to SQL in a .NET application: 



Comparing LINQ to SQL with LINQ to Entities 
 Now we know what LINQ to Entities is and what LINQ to SQL is. Next in this section, let's compare these two technologies.
As described earlier, LINQ to Entities applications work against a conceptual data model (EDM). All mappings between the languages and the databases go through the new EntityClient mapping provider. The application no longer connects directly to a database or sees any database-specific constructs. The entire application operates in terms of the higher level EDM. This means that you can no longer use the native database query language. Not only will the database not understand the EDM model, but also current database query languages do not have the constructs required to deal with the elements introduced by EDM such as inheritance, relationships, complex types, and so on. On the other hand, for developers who do not require mapping to a conceptual model, LINQ to SQL enables developers to experience the LINQ programming model directly over the existing database schema. LINQ to SQL allows developers to generate the .NET classes that represent data. Rather than mapping to a conceptual data model, these generated classes are mapped directly to database tables, views, stored procedures, and user-defined functions. Using LINQ to SQL, developers can write code directly against the storage schema, using the same LINQ programming pattern as was previously described for in-memory collections, entities, or the dataset, as well as for other data sources such as XML. Compared to LINQ to Entities, LINQ to SQL has some limitations, mainly because of its direct mapping against the physical relational storage schema. For example, you cannot map two different database entities into one single C# or VB object and if the underlying database schema changes, this might require significant client application changes.

To summarize, if you want to work against a conceptual data model, use LINQ to Entities. If you want to have a direct mapping to the database from your programming languages, use LINQ to SQL. The following table lists some of the features supported by these two data access methodologies:


Features
LINQ to SQL
LINQ to Entities


Conceptual data model
No
Yes
Storage schema
No
Yes
Mapping schema
No
Yes
New data access provider
No
Yes
Non-SQL Server database support
No
Yes
Direct database connection
Yes
No
Language extensions support
Yes
Yes
Stored procedures
Yes
Yes
Single-table inheritance
Yes
Yes
Multiple-table inheritance
No
Yes
Single entity from multiple tables
No
Yes
Lazy loading support
Yes
Yes


Interestingly, some people say LINQ to SQL was an intermediate solution. The fact is that LINQ to SQL was created by the C# team instead of the ADO.NET team. It was of great importance for the C# team to release an O/RM mapper together with their new LINQ technology. Without a LINQ to databases implementation, the C# team would have had a hard time evangelizing LINQ.
Some Best readings about LINQ: LINQ INTERESTING READINGS




WHAT IS LINQ PROVIDER

A LINQ provider is software that implements the IQueryProvider and IQueryable interfaces for a particular data store. In other words, it allows you to write LINQ queries against that data store. For example, LINQ to Active Directory ;which allows us to write Ling Queries against ACTIVE DIRECTORY or LINQ to XML provider allows you to write LINQ  queries against XML documents
 Here you can see series of posts for building Providers provider.
Complete list of posts in the Building an IQueryable Provider series 

Index

Core Microsoft LINQ Sites

Official Microsoft Flavors of LINQ

LINQ Providers

LINQ and Other Languages

Blogs and More LINQ Links

Third Party LINQ Books and Documents

How to Build a Full-Stack Web App with Blazor

  Blazor Stack Overview Important Points: Blazor stack gives you options to create Web Applications without writing JavaScript (doesn't ...