SlideShare ist ein Scribd-Unternehmen logo
1 von 20
 Networking
In the world of computers, networking is 
the practice of linking two or more 
computing devices together for the purpose 
of sharing data. Networks are built with a 
mix of computer hardware and computer 
software.
• A network consists of two or more computers 
that  are  linked  in  order  to  share  resources 
(such  as  printers  and  CDs),  exchange  files,  or 
allow electronic communications. 
• The  computers  on  a  network  may  be  linked 
through  cables,  telephone  lines,  radio  waves, 
satellites, or infrared light beams. 
• common types of networks :
– Local Area Network(LAN)
– Wide Area Network(WAN)
– Metropolitan area Network(MAN)
Advantages
• User access control , Information storing and 
sharing, Connections ,Services, Internet, 
sharing resources, Flexible Access. 

Disadvantages
• Expensive to Install, Requires Administrative 
Time, Servers Fail, Cables May Break, Security 
• A computer network consists of machines 
interconnected by communication channels.
• We call these machines hosts or routers . 
• Hosts are computers that run applications 
such as your Web browser, the application 
programs running on hosts are really the users 
of the network. 
• Routers are machines whose job is to relay or 
forward information from one communication 
channel to another. 
• By information we here mean a sequences of
bytes that are constructed and interpreted by 
programs. 
• In the context of computer networks these 
byte sequences are generally called packets .
• A protocol is an agreement about the packets 
exchanged .
•  TCP is designed to detect and recover from 
the losses, duplications, and other errors that 
may occur in the host-to-host channel 
provided by IP. 
• TCP provides a reliable byte-stream channel.
TCP/IP network
Socket
• A socket is one end-point of a two-way
communication link between two programs
running on the network.
• A server application normally listens to a specific
port waiting for connection requests from a client.
• When a connection request arrives, the client and
the server establish a dedicated connection over
which they can communicate.
• During the connection process, the client is
assigned a local port number, and binds a socket to
it. The client talks to the server by writing to the
socket and gets information from the server by
reading from it.
logical relationships among applications
Socket Addresses
• IPv4 uses 32-bit binary addresses to identify
communicating hosts.
• .NET encapsulates the IP addresses
abstraction in the IPAddress class which can
take a long integer IP argument in its
constructor, or process a string with the
dotted-quad representation of an IP address
using its Parse()method.
• The Dns class also provides a mechanism to
look up, or resolve names to IP addresses
(e.g., server.example.com ).
• a single server to resolve to multiple IP
addresses or name aliases, the results are
returned in a container class IPHostEntry,
which contains an array of one or more
string.
• The Dns class has several methods for
resolving IP addresses. The GetHostName()
method takes no arguments and returns a
string containing the local host name.
• The GetHostByName() and Resolve()methods
are basically identical, they take a string
argument containing the host name to be
looked up and returns the IP address and
host name.
• Information for the supplied input in the form
of an IPHostEntry class instance. The GetHostByAddress() method takes a string
argument containing the dotted-quad string
representation of an IP address and also
returns host information in an IPHostEntry
instance.
using System.Net;
using System.Net.Sockets;
namespace socket1
{
class IPAddressExample
{
static void PrintHostInfo(String host)
{
try {
IPHostEntry hostInfo;
// Attempt to resolve DNS for given host or address

hostInfo = Dns.Resolve(host);
// Display the primary host name

Console.WriteLine(" tCanonical Name : " + hostInfo.HostName);
// Display list of IP addresses for this host

Console.Write(" tIP Addresses: ");
foreach (IPAddress ipaddr in hostInfo.AddressList)
{
Console.Write(ipaddr.ToString()+"");
}
Console.WriteLine(" n");
}
catch (Exception)
{
Console.WriteLine(" tUnable to resolve host:"+ host+ "n");
}
static void Main(string[] args) {
// Get and print local host info
try {
Console.WriteLine("Local Host:");
String localHostName = Dns.GetHostName();
Console.WriteLine(" tHost Name: " + localHostName);
PrintHostInfo(localHostName);
}
catch (Exception)
{
Console.WriteLine("Unable to resolve local hostn");
}}
}
TCP classes
• The transmission control protocol (TCP) classes
offer simple methods for connecting and
sending data between two endpoints. An
endpoint is the combination of an IP address
and a port number.
• Existing protocols have well defined port
numbers, for example, HTTP uses port 80, while
SMTP uses port 25.
• The Internet Assigned Number Authority, IANA,
(http://www.iana.org/) assigns port numbers to
these well-known services.
• Socket: Low-level class that deals with
managing connections. Classes such as
WebRequest, TcpClient, and UdpClient use
this class internally.
• NetworkStream: Derived from Stream .
Represents a stream of data from/to the
network.
• TcpClient: Enables you to create and use TCP
connections.
• TcpListener: Enables you to listen for
incoming TCP connection requests.
• The TcpListener class listens for incoming TCP
connections with the Start()method.
• When a connection request arrives you can
use the AcceptSocket() method to return a
socket for communication with the remote
machine, or use the AcceptTcpClient()method
to use a higher-level TcpClient object for
communication.
• UdpClient: Enables you to create connections
for UDP clients. (UDP is an alternative
protocol to TCP, but is much less widely used,
mostly on local networks.)

Weitere ähnliche Inhalte

Was ist angesagt?

Networking Study Guide
Networking Study GuideNetworking Study Guide
Networking Study Guide
guested3b43
 
Socket programming
Socket programmingSocket programming
Socket programming
Divya Sharma
 

Was ist angesagt? (20)

Computer networks-4
Computer networks-4Computer networks-4
Computer networks-4
 
What is Socket Programming in Python | Edureka
What is Socket Programming in Python | EdurekaWhat is Socket Programming in Python | Edureka
What is Socket Programming in Python | Edureka
 
Distributed Systems Naming
Distributed Systems NamingDistributed Systems Naming
Distributed Systems Naming
 
Tcp
TcpTcp
Tcp
 
Socket programming or network programming
Socket programming or network programmingSocket programming or network programming
Socket programming or network programming
 
Internet Protocols
Internet ProtocolsInternet Protocols
Internet Protocols
 
Networking Study Guide
Networking Study GuideNetworking Study Guide
Networking Study Guide
 
TCP-IP PROTOCOL
TCP-IP PROTOCOLTCP-IP PROTOCOL
TCP-IP PROTOCOL
 
Network layers forwarding.docx
Network layers forwarding.docxNetwork layers forwarding.docx
Network layers forwarding.docx
 
Addressing in networking (IP,MAC,Port addressing)
Addressing in networking (IP,MAC,Port addressing)Addressing in networking (IP,MAC,Port addressing)
Addressing in networking (IP,MAC,Port addressing)
 
Socket programming
Socket programmingSocket programming
Socket programming
 
Bt0076, tcpip
Bt0076, tcpipBt0076, tcpip
Bt0076, tcpip
 
Computer Networks
Computer NetworksComputer Networks
Computer Networks
 
Session 6
Session 6Session 6
Session 6
 
Introduction to HTTP
Introduction to HTTPIntroduction to HTTP
Introduction to HTTP
 
Dcn class a subnetting
Dcn class a subnettingDcn class a subnetting
Dcn class a subnetting
 
Client server examples for tcp abnormal conditions
Client server examples for tcp abnormal conditionsClient server examples for tcp abnormal conditions
Client server examples for tcp abnormal conditions
 
Transport layer interface
Transport layer interface Transport layer interface
Transport layer interface
 
Computer network
Computer networkComputer network
Computer network
 
TCP/IP Presentation
TCP/IP PresentationTCP/IP Presentation
TCP/IP Presentation
 

Andere mochten auch (13)

LAN TECHNOLOGIES
LAN TECHNOLOGIESLAN TECHNOLOGIES
LAN TECHNOLOGIES
 
Lan technologies
Lan technologiesLan technologies
Lan technologies
 
Chapter 8 lan_technologies_and_network_topology
Chapter 8 lan_technologies_and_network_topologyChapter 8 lan_technologies_and_network_topology
Chapter 8 lan_technologies_and_network_topology
 
Chapter3
Chapter3Chapter3
Chapter3
 
Lan technologies
Lan technologiesLan technologies
Lan technologies
 
Wireless LAN technologies
Wireless LAN technologiesWireless LAN technologies
Wireless LAN technologies
 
Congestion control and quality of services
Congestion control and quality of servicesCongestion control and quality of services
Congestion control and quality of services
 
Ppt of socket
Ppt of socketPpt of socket
Ppt of socket
 
Flow & Error Control
Flow & Error ControlFlow & Error Control
Flow & Error Control
 
Ports & sockets
Ports  & sockets Ports  & sockets
Ports & sockets
 
24 Congestion Control_and_Quality_of_Service
24 Congestion Control_and_Quality_of_Service24 Congestion Control_and_Quality_of_Service
24 Congestion Control_and_Quality_of_Service
 
Local area network
Local area networkLocal area network
Local area network
 
Error Detection And Correction
Error Detection And CorrectionError Detection And Correction
Error Detection And Correction
 

Ähnlich wie Networking and socket

chapter-4-networking hjgjjgj did hfhhfhj
chapter-4-networking hjgjjgj did hfhhfhjchapter-4-networking hjgjjgj did hfhhfhj
chapter-4-networking hjgjjgj did hfhhfhj
AmitDeshai
 
Fundamentals of Networking
Fundamentals of NetworkingFundamentals of Networking
Fundamentals of Networking
Israel Marcus
 

Ähnlich wie Networking and socket (20)

09 Systems Software Programming-Network Programming.pptx
09 Systems Software Programming-Network Programming.pptx09 Systems Software Programming-Network Programming.pptx
09 Systems Software Programming-Network Programming.pptx
 
Network Programming in Java
Network Programming in JavaNetwork Programming in Java
Network Programming in Java
 
Computing 9
Computing 9Computing 9
Computing 9
 
Network programming in Java
Network programming in JavaNetwork programming in Java
Network programming in Java
 
chapter-4-networking hjgjjgj did hfhhfhj
chapter-4-networking hjgjjgj did hfhhfhjchapter-4-networking hjgjjgj did hfhhfhj
chapter-4-networking hjgjjgj did hfhhfhj
 
28 networking
28  networking28  networking
28 networking
 
M.Florence Dayana Computer Networks Introduction
M.Florence Dayana   Computer Networks IntroductionM.Florence Dayana   Computer Networks Introduction
M.Florence Dayana Computer Networks Introduction
 
Dasar komputer chapter8
Dasar komputer chapter8Dasar komputer chapter8
Dasar komputer chapter8
 
Sept 2017 internetworking
Sept 2017   internetworkingSept 2017   internetworking
Sept 2017 internetworking
 
Network & internet presentation
Network & internet presentationNetwork & internet presentation
Network & internet presentation
 
Chapter15.pptx
Chapter15.pptxChapter15.pptx
Chapter15.pptx
 
Networking And Internet
Networking And InternetNetworking And Internet
Networking And Internet
 
Md13 networking
Md13 networkingMd13 networking
Md13 networking
 
Fundamentals of Networking
Fundamentals of NetworkingFundamentals of Networking
Fundamentals of Networking
 
Network programming in java - PPT
Network programming in java - PPTNetwork programming in java - PPT
Network programming in java - PPT
 
Networks
NetworksNetworks
Networks
 
NME UNIT I & II MATERIAL.pdf
NME UNIT I & II MATERIAL.pdfNME UNIT I & II MATERIAL.pdf
NME UNIT I & II MATERIAL.pdf
 
Client server chat application
Client server chat applicationClient server chat application
Client server chat application
 
Networking
NetworkingNetworking
Networking
 
network fundamentals
network fundamentalsnetwork fundamentals
network fundamentals
 

Mehr von abhay singh (15)

Iso 27001
Iso 27001Iso 27001
Iso 27001
 
Web service
Web serviceWeb service
Web service
 
Unsafe
UnsafeUnsafe
Unsafe
 
Threading
ThreadingThreading
Threading
 
Preprocessor
PreprocessorPreprocessor
Preprocessor
 
Namespace
NamespaceNamespace
Namespace
 
Inheritance
InheritanceInheritance
Inheritance
 
Generic
GenericGeneric
Generic
 
Gdi
GdiGdi
Gdi
 
Exception
ExceptionException
Exception
 
Delegate
DelegateDelegate
Delegate
 
Constructor
ConstructorConstructor
Constructor
 
Collection
CollectionCollection
Collection
 
Ado
AdoAdo
Ado
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 

Kürzlich hochgeladen

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 

Kürzlich hochgeladen (20)

Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 

Networking and socket

  • 2. • A network consists of two or more computers  that  are  linked  in  order  to  share  resources  (such  as  printers  and  CDs),  exchange  files,  or  allow electronic communications.  • The  computers  on  a  network  may  be  linked  through  cables,  telephone  lines,  radio  waves,  satellites, or infrared light beams.  • common types of networks : – Local Area Network(LAN) – Wide Area Network(WAN) – Metropolitan area Network(MAN)
  • 4. • A computer network consists of machines  interconnected by communication channels. • We call these machines hosts or routers .  • Hosts are computers that run applications  such as your Web browser, the application  programs running on hosts are really the users  of the network.  • Routers are machines whose job is to relay or  forward information from one communication  channel to another. 
  • 5. • By information we here mean a sequences of bytes that are constructed and interpreted by  programs.  • In the context of computer networks these  byte sequences are generally called packets . • A protocol is an agreement about the packets  exchanged . •  TCP is designed to detect and recover from  the losses, duplications, and other errors that  may occur in the host-to-host channel  provided by IP.  • TCP provides a reliable byte-stream channel.
  • 7. Socket • A socket is one end-point of a two-way communication link between two programs running on the network. • A server application normally listens to a specific port waiting for connection requests from a client. • When a connection request arrives, the client and the server establish a dedicated connection over which they can communicate. • During the connection process, the client is assigned a local port number, and binds a socket to it. The client talks to the server by writing to the socket and gets information from the server by reading from it.
  • 9. Socket Addresses • IPv4 uses 32-bit binary addresses to identify communicating hosts. • .NET encapsulates the IP addresses abstraction in the IPAddress class which can take a long integer IP argument in its constructor, or process a string with the dotted-quad representation of an IP address using its Parse()method. • The Dns class also provides a mechanism to look up, or resolve names to IP addresses (e.g., server.example.com ).
  • 10. • a single server to resolve to multiple IP addresses or name aliases, the results are returned in a container class IPHostEntry, which contains an array of one or more string. • The Dns class has several methods for resolving IP addresses. The GetHostName() method takes no arguments and returns a string containing the local host name.
  • 11. • The GetHostByName() and Resolve()methods are basically identical, they take a string argument containing the host name to be looked up and returns the IP address and host name. • Information for the supplied input in the form of an IPHostEntry class instance. The GetHostByAddress() method takes a string argument containing the dotted-quad string representation of an IP address and also returns host information in an IPHostEntry instance.
  • 12. using System.Net; using System.Net.Sockets; namespace socket1 { class IPAddressExample { static void PrintHostInfo(String host) { try { IPHostEntry hostInfo; // Attempt to resolve DNS for given host or address hostInfo = Dns.Resolve(host);
  • 13. // Display the primary host name Console.WriteLine(" tCanonical Name : " + hostInfo.HostName); // Display list of IP addresses for this host Console.Write(" tIP Addresses: "); foreach (IPAddress ipaddr in hostInfo.AddressList) { Console.Write(ipaddr.ToString()+""); } Console.WriteLine(" n"); } catch (Exception) { Console.WriteLine(" tUnable to resolve host:"+ host+ "n"); }
  • 14. static void Main(string[] args) { // Get and print local host info try { Console.WriteLine("Local Host:"); String localHostName = Dns.GetHostName(); Console.WriteLine(" tHost Name: " + localHostName); PrintHostInfo(localHostName); } catch (Exception) { Console.WriteLine("Unable to resolve local hostn"); }} }
  • 15.
  • 16.
  • 17. TCP classes • The transmission control protocol (TCP) classes offer simple methods for connecting and sending data between two endpoints. An endpoint is the combination of an IP address and a port number. • Existing protocols have well defined port numbers, for example, HTTP uses port 80, while SMTP uses port 25. • The Internet Assigned Number Authority, IANA, (http://www.iana.org/) assigns port numbers to these well-known services.
  • 18. • Socket: Low-level class that deals with managing connections. Classes such as WebRequest, TcpClient, and UdpClient use this class internally. • NetworkStream: Derived from Stream . Represents a stream of data from/to the network. • TcpClient: Enables you to create and use TCP connections.
  • 19. • TcpListener: Enables you to listen for incoming TCP connection requests. • The TcpListener class listens for incoming TCP connections with the Start()method. • When a connection request arrives you can use the AcceptSocket() method to return a socket for communication with the remote machine, or use the AcceptTcpClient()method to use a higher-level TcpClient object for communication.
  • 20. • UdpClient: Enables you to create connections for UDP clients. (UDP is an alternative protocol to TCP, but is much less widely used, mostly on local networks.)