SlideShare a Scribd company logo
Q7M1 – SC Dudy Fathan Ali S.Kom
Network Socket Programming
Q7M1
Dudy Fathan Ali, S.Kom (DFA)
2017
CEP - CCIT
Fakultas Teknik Universitas Indonesia
Consider this scenario..
Q7M1 – SC Dudy Fathan Ali S.Kom
Hello, I want a
pizza.
Guys, bob
wants a pizza!
Bob
Pizza Store
Consider this scenario..
Q7M1 – SC Dudy Fathan Ali S.Kom
Pizza Store
Standard Operational Procedure
Hmm..
Q7M1 – SC Dudy Fathan Ali S.Kom
Client/Server Architecture
Q7M1 – SC Dudy Fathan Ali S.Kom
Bob
[Client]
Pizza Store
[Server]
The client places a
request or order
to the server.
The server processes
the request of the
client
The communication
between the client
and the server is
usually through a
network.
The Client/Server model is an application development architecture designed to separate
the presentation of data from its internal processing and storage.
Client/Server Architecture
Q7M1 – SC Dudy Fathan Ali S.Kom
Pizza Store
The processing that is done by the server is hidden from the client.
Client/Server Architecture
Q7M1 – SC Dudy Fathan Ali S.Kom
Steve
Bob
John
One server can service multiple clients.
Client/Server Architecture
Q7M1 – SC Dudy Fathan Ali S.Kom
The server and the client are not necessarily hardware components.
They can be programs working on the same machine or on different
machines.
Internet Protocol
Q7M1 – SC Dudy Fathan Ali S.Kom
The Internet Protocol (IP) is the principal communications protocol in the
Internet protocol suite for relaying datagrams across network boundaries.
Its routing function enables internetworking, and essentially establishes
the Internet.
-- Source: wikipedia.org
-- Source: google.com
Internet Protocol
Q7M1 – SC Dudy Fathan Ali S.Kom
implicit rules in conversation?
Internet Protocol
Q7M1 – SC Dudy Fathan Ali S.Kom
o Data is sent from one machine to another in form of packets.
o Rules govern packaging of data into packets, speed of transmission, and
reassembling of data into its original form.
o These rules are called network protocols.
Communication rules between computers
IP Address & Port
Q7M1 – SC Dudy Fathan Ali S.Kom
IP Address & Port
Q7M1 – SC Dudy Fathan Ali S.Kom
The TCP protocol requires two data items: the IP address
and the port number.
172.17.8.192 : 80
IP Address Port
o Well-known ports
o Registered ports
o Dynamic/Private ports
IP Address & Port
Q7M1 – SC Dudy Fathan Ali S.Kom
IP Addresses of Popular Websites
Sockets
Q7M1 – SC Dudy Fathan Ali S.Kom
Sockets are used to handle the communication links between
applications over the network. Further communication between the
client and the server is through the socket.
-- Source: NIIT Courseware Q7M1
Java Classes for Network Programming
Q7M1 – SC Dudy Fathan Ali S.Kom
o The java.net package of the Java programming language contains
classes and interfaces that provide support for networking.
o Networking classes contain methods to perform tasks, such as
opening and closing a connection to remote machine, sending and
receiving data packets and accessing resources on the Web.
Java Classes for Network Programming
Q7M1 – SC Dudy Fathan Ali S.Kom
Classes of the java.net Package:
o DatagramPacket
o Represents a datagram packet.
o DatagramSocket
o Represents a datagram socket object that can send and receive datagram
packets.
o MulticastSocket
o Creates a multicast datagram socket object that is used to send and receive
datagram packets to groups.
o InetAddress
o Represents an IP address.
o ServerSocket
o Represents a TCP/IP server socket object that receives connection requests from
the clients.
Java Classes for Network Programming
Q7M1 – SC Dudy Fathan Ali S.Kom
The InetAddress Class:
o Represents an IP address.
o Contains the following static methods to initialize InetAddress
objects:
o public static InetAddress getLocalHost()
o public static InetAddress getByName(String host)
o public static InetAddress[] getAllByName(String host)
Java Classes for Network Programming
Q7M1 – SC Dudy Fathan Ali S.Kom
The non-static methods of the InetAddress class are:
o public boolean equals(Object obj)
o public byte[] getAddress()
o public String getHostAddress()
o public String toString()
Java Classes for Network Programming
Q7M1 – SC Dudy Fathan Ali S.Kom
Code Example:
Result:
Returns an
InetAddress object
that contains the IP
address of the local
computer.
Returns the IP address of
the InetAddress
object as a String.
TCP vs UDP
Q7M1 – SC Dudy Fathan Ali S.Kom
TCP vs UDP
Q7M1 – SC Dudy Fathan Ali S.Kom
Creating Application Using UDP
Q7M1 – SC Dudy Fathan Ali S.Kom
o UDP is a fast, connectionless, and unreliable protocol.
o UDP sockets use UDP protocol for communication over a network.
o The java.net package provides the following two classes that
enable you to implement UDP sockets in a Java application:
o DatagramPacket class
o DatagramSocket class
o The DatagramPacket object is a data container that consists of
datagram packets that are sent or received over the network.
o The constructor used to initialize DatagramPacket objects are:
o public DatagramPacket( byte[] buffer, int
buffer_length)
o public DatagramPacket( byte[] buffer, int
buffer_length, InetAddress address, int port)
Creating Application Using UDP
Q7M1 – SC Dudy Fathan Ali S.Kom
o DatagramSocket class encapsulates the functionality to handle
DatagramPacket objects.
o The constructors used to initialize DatagramSocket object are:
o public DatagramSocket()
o public DatagramSocket(int port)
o public DatagramSocket(int port, InetAddress
address)
Creating Application Using UDP
Q7M1 – SC Dudy Fathan Ali S.Kom
Code Example [DataSender]:
Creating Application Using UDP
Q7M1 – SC Dudy Fathan Ali S.Kom
Code Example [DataReceiver]:
Demonstration-Implementing UDP
Q7M1 – SC Dudy Fathan Ali S.Kom
Create a Client/Server
application where the server
can broadcast messages to all
the clients of 233.0.0.1 group.
Q7M1 – SC Dudy Fathan Ali S.Kom
Thank You!
Dudy Fathan Ali, S.Kom
dudy.fathan@eng.ui.ac.id

More Related Content

What's hot

Wireshark course, Ch 03: Capture and display filters
Wireshark course, Ch 03: Capture and display filtersWireshark course, Ch 03: Capture and display filters
Wireshark course, Ch 03: Capture and display filtersYoram Orzach
 
EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4Max Kleiner
 
Comparing Cpp And Erlang For Motorola Telecoms Software
Comparing Cpp And Erlang For Motorola Telecoms SoftwareComparing Cpp And Erlang For Motorola Telecoms Software
Comparing Cpp And Erlang For Motorola Telecoms Softwarel xf
 
Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Max Kleiner
 
Lab manual cn-2012-13
Lab manual cn-2012-13Lab manual cn-2012-13
Lab manual cn-2012-13Sasi Kala
 
Networks lab manual ecp62
Networks lab manual ecp62Networks lab manual ecp62
Networks lab manual ecp62Basil John
 
Networking and Go: An Epic Journey
Networking and Go: An Epic JourneyNetworking and Go: An Epic Journey
Networking and Go: An Epic JourneySneha Inguva
 
Networking Fundamentals: Transport Protocols (TCP and UDP)
Networking Fundamentals: Transport Protocols (TCP and UDP)Networking Fundamentals: Transport Protocols (TCP and UDP)
Networking Fundamentals: Transport Protocols (TCP and UDP)Andriy Berestovskyy
 
Arduino C maXbox web of things slide show
Arduino C maXbox web of things slide showArduino C maXbox web of things slide show
Arduino C maXbox web of things slide showMax Kleiner
 
Ch 09 -- ARP & IP Analysis
Ch 09 -- ARP & IP AnalysisCh 09 -- ARP & IP Analysis
Ch 09 -- ARP & IP AnalysisYoram Orzach
 
A closure ekon16
A closure ekon16A closure ekon16
A closure ekon16Max Kleiner
 
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)Thomas Graf
 
Introduction to Remote Procedure Call
Introduction to Remote Procedure CallIntroduction to Remote Procedure Call
Introduction to Remote Procedure CallAbdelrahman Al-Ogail
 
Metrics ekon 14_2_kleiner
Metrics ekon 14_2_kleinerMetrics ekon 14_2_kleiner
Metrics ekon 14_2_kleinerMax Kleiner
 
Ds objects and models
Ds objects and modelsDs objects and models
Ds objects and modelsMayank Jain
 

What's hot (20)

Wireshark course, Ch 03: Capture and display filters
Wireshark course, Ch 03: Capture and display filtersWireshark course, Ch 03: Capture and display filters
Wireshark course, Ch 03: Capture and display filters
 
EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4
 
Comparing Cpp And Erlang For Motorola Telecoms Software
Comparing Cpp And Erlang For Motorola Telecoms SoftwareComparing Cpp And Erlang For Motorola Telecoms Software
Comparing Cpp And Erlang For Motorola Telecoms Software
 
Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475
 
Lab manual cn-2012-13
Lab manual cn-2012-13Lab manual cn-2012-13
Lab manual cn-2012-13
 
Sockets
Sockets Sockets
Sockets
 
Netcat cheat sheet_v1
Netcat cheat sheet_v1Netcat cheat sheet_v1
Netcat cheat sheet_v1
 
Networks lab manual ecp62
Networks lab manual ecp62Networks lab manual ecp62
Networks lab manual ecp62
 
Networking and Go: An Epic Journey
Networking and Go: An Epic JourneyNetworking and Go: An Epic Journey
Networking and Go: An Epic Journey
 
Networking Fundamentals: Transport Protocols (TCP and UDP)
Networking Fundamentals: Transport Protocols (TCP and UDP)Networking Fundamentals: Transport Protocols (TCP and UDP)
Networking Fundamentals: Transport Protocols (TCP and UDP)
 
Part 6 : Internet applications
Part 6 : Internet applicationsPart 6 : Internet applications
Part 6 : Internet applications
 
Sanitizing PCAPs
Sanitizing PCAPsSanitizing PCAPs
Sanitizing PCAPs
 
ACIT Mumbai - OSI Model
ACIT Mumbai - OSI ModelACIT Mumbai - OSI Model
ACIT Mumbai - OSI Model
 
Arduino C maXbox web of things slide show
Arduino C maXbox web of things slide showArduino C maXbox web of things slide show
Arduino C maXbox web of things slide show
 
Ch 09 -- ARP & IP Analysis
Ch 09 -- ARP & IP AnalysisCh 09 -- ARP & IP Analysis
Ch 09 -- ARP & IP Analysis
 
A closure ekon16
A closure ekon16A closure ekon16
A closure ekon16
 
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
 
Introduction to Remote Procedure Call
Introduction to Remote Procedure CallIntroduction to Remote Procedure Call
Introduction to Remote Procedure Call
 
Metrics ekon 14_2_kleiner
Metrics ekon 14_2_kleinerMetrics ekon 14_2_kleiner
Metrics ekon 14_2_kleiner
 
Ds objects and models
Ds objects and modelsDs objects and models
Ds objects and models
 

Viewers also liked

Java CRUD Mechanism with SQL Server Database
Java CRUD Mechanism with SQL Server DatabaseJava CRUD Mechanism with SQL Server Database
Java CRUD Mechanism with SQL Server DatabaseDudy Ali
 
Networking Java Socket Programming
Networking Java Socket ProgrammingNetworking Java Socket Programming
Networking Java Socket ProgrammingMousmi Pawar
 
Socket Programming Tutorial
Socket Programming TutorialSocket Programming Tutorial
Socket Programming TutorialJignesh Patel
 
Socket Programming - nitish nagar
Socket Programming - nitish nagarSocket Programming - nitish nagar
Socket Programming - nitish nagarNitish Nagar
 
Database Introduction - Akses Data dengan SQL Server
Database Introduction - Akses Data dengan SQL ServerDatabase Introduction - Akses Data dengan SQL Server
Database Introduction - Akses Data dengan SQL ServerDudy Ali
 
Networking & Socket Programming In Java
Networking & Socket Programming In JavaNetworking & Socket Programming In Java
Networking & Socket Programming In JavaAnkur Agrawal
 
Information System Security - Akuntabilitas dan Akses Kontrol
Information System Security - Akuntabilitas dan Akses KontrolInformation System Security - Akuntabilitas dan Akses Kontrol
Information System Security - Akuntabilitas dan Akses KontrolDudy Ali
 
Object Oriented Programming - File Input & Output
Object Oriented Programming - File Input & OutputObject Oriented Programming - File Input & Output
Object Oriented Programming - File Input & OutputDudy Ali
 
Object Oriented Programming - Inheritance
Object Oriented Programming - InheritanceObject Oriented Programming - Inheritance
Object Oriented Programming - InheritanceDudy Ali
 
Information System Security - Prinsip Manajemen Keamanan
Information System Security - Prinsip Manajemen KeamananInformation System Security - Prinsip Manajemen Keamanan
Information System Security - Prinsip Manajemen KeamananDudy Ali
 
Socket programming in Java (PPTX)
Socket programming in Java (PPTX)Socket programming in Java (PPTX)
Socket programming in Java (PPTX)UC San Diego
 
Socket programming using java
Socket programming using javaSocket programming using java
Socket programming using javaUC San Diego
 
Information System Security - Konsep Manajemen Keamanan
Information System Security - Konsep Manajemen KeamananInformation System Security - Konsep Manajemen Keamanan
Information System Security - Konsep Manajemen KeamananDudy Ali
 
Object Oriented Programming - Value Types & Reference Types
Object Oriented Programming - Value Types & Reference TypesObject Oriented Programming - Value Types & Reference Types
Object Oriented Programming - Value Types & Reference TypesDudy Ali
 
Easy Steps to implement UDP Server and Client Sockets
Easy Steps to implement UDP Server and Client SocketsEasy Steps to implement UDP Server and Client Sockets
Easy Steps to implement UDP Server and Client Socketsbabak danyal
 
Java networking programs - theory
Java networking programs - theoryJava networking programs - theory
Java networking programs - theoryMukesh Tekwani
 
Netty Cookbook - Table of contents
Netty Cookbook - Table of contentsNetty Cookbook - Table of contents
Netty Cookbook - Table of contentsTrieu Nguyen
 
Information System Security - Kriptografi
Information System Security - KriptografiInformation System Security - Kriptografi
Information System Security - KriptografiDudy Ali
 

Viewers also liked (20)

Java CRUD Mechanism with SQL Server Database
Java CRUD Mechanism with SQL Server DatabaseJava CRUD Mechanism with SQL Server Database
Java CRUD Mechanism with SQL Server Database
 
Sockets
SocketsSockets
Sockets
 
Networking Java Socket Programming
Networking Java Socket ProgrammingNetworking Java Socket Programming
Networking Java Socket Programming
 
Socket Programming Tutorial
Socket Programming TutorialSocket Programming Tutorial
Socket Programming Tutorial
 
Socket Programming - nitish nagar
Socket Programming - nitish nagarSocket Programming - nitish nagar
Socket Programming - nitish nagar
 
Database Introduction - Akses Data dengan SQL Server
Database Introduction - Akses Data dengan SQL ServerDatabase Introduction - Akses Data dengan SQL Server
Database Introduction - Akses Data dengan SQL Server
 
Networking & Socket Programming In Java
Networking & Socket Programming In JavaNetworking & Socket Programming In Java
Networking & Socket Programming In Java
 
Information System Security - Akuntabilitas dan Akses Kontrol
Information System Security - Akuntabilitas dan Akses KontrolInformation System Security - Akuntabilitas dan Akses Kontrol
Information System Security - Akuntabilitas dan Akses Kontrol
 
Object Oriented Programming - File Input & Output
Object Oriented Programming - File Input & OutputObject Oriented Programming - File Input & Output
Object Oriented Programming - File Input & Output
 
Object Oriented Programming - Inheritance
Object Oriented Programming - InheritanceObject Oriented Programming - Inheritance
Object Oriented Programming - Inheritance
 
Information System Security - Prinsip Manajemen Keamanan
Information System Security - Prinsip Manajemen KeamananInformation System Security - Prinsip Manajemen Keamanan
Information System Security - Prinsip Manajemen Keamanan
 
Socket programming in Java (PPTX)
Socket programming in Java (PPTX)Socket programming in Java (PPTX)
Socket programming in Java (PPTX)
 
Socket programming using java
Socket programming using javaSocket programming using java
Socket programming using java
 
Information System Security - Konsep Manajemen Keamanan
Information System Security - Konsep Manajemen KeamananInformation System Security - Konsep Manajemen Keamanan
Information System Security - Konsep Manajemen Keamanan
 
Object Oriented Programming - Value Types & Reference Types
Object Oriented Programming - Value Types & Reference TypesObject Oriented Programming - Value Types & Reference Types
Object Oriented Programming - Value Types & Reference Types
 
Jnp
JnpJnp
Jnp
 
Easy Steps to implement UDP Server and Client Sockets
Easy Steps to implement UDP Server and Client SocketsEasy Steps to implement UDP Server and Client Sockets
Easy Steps to implement UDP Server and Client Sockets
 
Java networking programs - theory
Java networking programs - theoryJava networking programs - theory
Java networking programs - theory
 
Netty Cookbook - Table of contents
Netty Cookbook - Table of contentsNetty Cookbook - Table of contents
Netty Cookbook - Table of contents
 
Information System Security - Kriptografi
Information System Security - KriptografiInformation System Security - Kriptografi
Information System Security - Kriptografi
 

Similar to Network Socket Programming with JAVA

محمد مشاري
محمد مشاريمحمد مشاري
محمد مشاريmaherrrrz
 
Chapter 07 - Transport Layer
Chapter 07 - Transport LayerChapter 07 - Transport Layer
Chapter 07 - Transport LayerYaser Rahmati
 
Chapter 7 : Transport layer
Chapter 7 : Transport layerChapter 7 : Transport layer
Chapter 7 : Transport layerteknetir
 
CCNAv5 - S1: Chapter 7 - Transport Layer
CCNAv5 - S1: Chapter 7 - Transport LayerCCNAv5 - S1: Chapter 7 - Transport Layer
CCNAv5 - S1: Chapter 7 - Transport LayerVuz Dở Hơi
 
Ccna v5-S1-Chapter 7
Ccna v5-S1-Chapter 7Ccna v5-S1-Chapter 7
Ccna v5-S1-Chapter 7Hamza Malik
 
CCNAv5 - S4: Chapter3 Point to-point Connections
CCNAv5 - S4: Chapter3 Point to-point ConnectionsCCNAv5 - S4: Chapter3 Point to-point Connections
CCNAv5 - S4: Chapter3 Point to-point ConnectionsVuz Dở Hơi
 
CCNA RS_ITN - Chapter 7
CCNA RS_ITN - Chapter 7CCNA RS_ITN - Chapter 7
CCNA RS_ITN - Chapter 7Irsandi Hasan
 
Presentation 3 for Students of professordkinney.com
Presentation 3 for Students of professordkinney.comPresentation 3 for Students of professordkinney.com
Presentation 3 for Students of professordkinney.comArnold Derrick Kinney
 
cisco-nti-Day18
cisco-nti-Day18cisco-nti-Day18
cisco-nti-Day18eyad alaa
 
CCNA 1 Routing and Switching v5.0 Chapter 7
CCNA 1 Routing and Switching v5.0 Chapter 7CCNA 1 Routing and Switching v5.0 Chapter 7
CCNA 1 Routing and Switching v5.0 Chapter 7Nil Menon
 
Bangladesh Computer Council Networking Project
Bangladesh Computer Council Networking ProjectBangladesh Computer Council Networking Project
Bangladesh Computer Council Networking ProjectMDMusab
 
CCNA RS_NB - Chapter 5
CCNA RS_NB - Chapter 5CCNA RS_NB - Chapter 5
CCNA RS_NB - Chapter 5Irsandi Hasan
 
Transport Layer Numericals
Transport Layer NumericalsTransport Layer Numericals
Transport Layer NumericalsManisha Keim
 
Bcc network connection
Bcc network connectionBcc network connection
Bcc network connectionMDMusab
 
Ip tunnelling and_vpn
Ip tunnelling and_vpnIp tunnelling and_vpn
Ip tunnelling and_vpnRajesh Porwal
 
Introduction to netlink in linux kernel (english)
Introduction to netlink in linux kernel (english)Introduction to netlink in linux kernel (english)
Introduction to netlink in linux kernel (english)Sneeker Yeh
 
eProsima RPC over DDS - OMG June 2013 Berlin Meeting
eProsima RPC over DDS - OMG June 2013 Berlin MeetingeProsima RPC over DDS - OMG June 2013 Berlin Meeting
eProsima RPC over DDS - OMG June 2013 Berlin MeetingJaime Martin Losa
 

Similar to Network Socket Programming with JAVA (20)

محمد مشاري
محمد مشاريمحمد مشاري
محمد مشاري
 
Chapter 07 - Transport Layer
Chapter 07 - Transport LayerChapter 07 - Transport Layer
Chapter 07 - Transport Layer
 
Chapter 7 : Transport layer
Chapter 7 : Transport layerChapter 7 : Transport layer
Chapter 7 : Transport layer
 
CCNAv5 - S1: Chapter 7 - Transport Layer
CCNAv5 - S1: Chapter 7 - Transport LayerCCNAv5 - S1: Chapter 7 - Transport Layer
CCNAv5 - S1: Chapter 7 - Transport Layer
 
Ccna v5-S1-Chapter 7
Ccna v5-S1-Chapter 7Ccna v5-S1-Chapter 7
Ccna v5-S1-Chapter 7
 
CCNAv5 - S4: Chapter3 Point to-point Connections
CCNAv5 - S4: Chapter3 Point to-point ConnectionsCCNAv5 - S4: Chapter3 Point to-point Connections
CCNAv5 - S4: Chapter3 Point to-point Connections
 
OpenDataPlane Project
OpenDataPlane ProjectOpenDataPlane Project
OpenDataPlane Project
 
CCNA RS_ITN - Chapter 7
CCNA RS_ITN - Chapter 7CCNA RS_ITN - Chapter 7
CCNA RS_ITN - Chapter 7
 
Presentation 3 for Students of professordkinney.com
Presentation 3 for Students of professordkinney.comPresentation 3 for Students of professordkinney.com
Presentation 3 for Students of professordkinney.com
 
Project report,nowrin
Project report,nowrinProject report,nowrin
Project report,nowrin
 
cisco-nti-Day18
cisco-nti-Day18cisco-nti-Day18
cisco-nti-Day18
 
CCNA 1 Routing and Switching v5.0 Chapter 7
CCNA 1 Routing and Switching v5.0 Chapter 7CCNA 1 Routing and Switching v5.0 Chapter 7
CCNA 1 Routing and Switching v5.0 Chapter 7
 
Bangladesh Computer Council Networking Project
Bangladesh Computer Council Networking ProjectBangladesh Computer Council Networking Project
Bangladesh Computer Council Networking Project
 
CCNA RS_NB - Chapter 5
CCNA RS_NB - Chapter 5CCNA RS_NB - Chapter 5
CCNA RS_NB - Chapter 5
 
Transport Layer Numericals
Transport Layer NumericalsTransport Layer Numericals
Transport Layer Numericals
 
Bcc network connection
Bcc network connectionBcc network connection
Bcc network connection
 
Ip tunnelling and_vpn
Ip tunnelling and_vpnIp tunnelling and_vpn
Ip tunnelling and_vpn
 
Introduction to netlink in linux kernel (english)
Introduction to netlink in linux kernel (english)Introduction to netlink in linux kernel (english)
Introduction to netlink in linux kernel (english)
 
Client server
Client serverClient server
Client server
 
eProsima RPC over DDS - OMG June 2013 Berlin Meeting
eProsima RPC over DDS - OMG June 2013 Berlin MeetingeProsima RPC over DDS - OMG June 2013 Berlin Meeting
eProsima RPC over DDS - OMG June 2013 Berlin Meeting
 

More from Dudy Ali

Understanding COM+
Understanding COM+Understanding COM+
Understanding COM+Dudy Ali
 
Distributed Application Development (Introduction)
Distributed Application Development (Introduction)Distributed Application Development (Introduction)
Distributed Application Development (Introduction)Dudy Ali
 
Review Materi ASP.NET
Review Materi ASP.NETReview Materi ASP.NET
Review Materi ASP.NETDudy Ali
 
XML Schema Part 2
XML Schema Part 2XML Schema Part 2
XML Schema Part 2Dudy Ali
 
XML Schema Part 1
XML Schema Part 1XML Schema Part 1
XML Schema Part 1Dudy Ali
 
Rendering XML Document
Rendering XML DocumentRendering XML Document
Rendering XML DocumentDudy Ali
 
Pengantar XML
Pengantar XMLPengantar XML
Pengantar XMLDudy Ali
 
Pengantar XML DOM
Pengantar XML DOMPengantar XML DOM
Pengantar XML DOMDudy Ali
 
Pengantar ADO.NET
Pengantar ADO.NETPengantar ADO.NET
Pengantar ADO.NETDudy Ali
 
Database Connectivity with JDBC
Database Connectivity with JDBCDatabase Connectivity with JDBC
Database Connectivity with JDBCDudy Ali
 
XML - Displaying Data ith XSLT
XML - Displaying Data ith XSLTXML - Displaying Data ith XSLT
XML - Displaying Data ith XSLTDudy Ali
 
Algorithm & Data Structure - Algoritma Pengurutan
Algorithm & Data Structure - Algoritma PengurutanAlgorithm & Data Structure - Algoritma Pengurutan
Algorithm & Data Structure - Algoritma PengurutanDudy Ali
 
Algorithm & Data Structure - Pengantar
Algorithm & Data Structure - PengantarAlgorithm & Data Structure - Pengantar
Algorithm & Data Structure - PengantarDudy Ali
 
Object Oriented Programming - Constructors & Destructors
Object Oriented Programming - Constructors & DestructorsObject Oriented Programming - Constructors & Destructors
Object Oriented Programming - Constructors & DestructorsDudy Ali
 
Object Oriented Programming - Abstraction & Encapsulation
Object Oriented Programming - Abstraction & EncapsulationObject Oriented Programming - Abstraction & Encapsulation
Object Oriented Programming - Abstraction & EncapsulationDudy Ali
 
Web Programming Syaria - Pengenalan Halaman Web
Web Programming Syaria - Pengenalan Halaman WebWeb Programming Syaria - Pengenalan Halaman Web
Web Programming Syaria - Pengenalan Halaman WebDudy Ali
 
Web Programming Syaria - PHP
Web Programming Syaria - PHPWeb Programming Syaria - PHP
Web Programming Syaria - PHPDudy Ali
 
Software Project Management - Project Management Knowledge
Software Project Management - Project Management KnowledgeSoftware Project Management - Project Management Knowledge
Software Project Management - Project Management KnowledgeDudy Ali
 
Software Project Management - Proses Manajemen Proyek
Software Project Management - Proses Manajemen ProyekSoftware Project Management - Proses Manajemen Proyek
Software Project Management - Proses Manajemen ProyekDudy Ali
 
Software Project Management - Pengenalan Manajemen Proyek
Software Project Management - Pengenalan Manajemen ProyekSoftware Project Management - Pengenalan Manajemen Proyek
Software Project Management - Pengenalan Manajemen ProyekDudy Ali
 

More from Dudy Ali (20)

Understanding COM+
Understanding COM+Understanding COM+
Understanding COM+
 
Distributed Application Development (Introduction)
Distributed Application Development (Introduction)Distributed Application Development (Introduction)
Distributed Application Development (Introduction)
 
Review Materi ASP.NET
Review Materi ASP.NETReview Materi ASP.NET
Review Materi ASP.NET
 
XML Schema Part 2
XML Schema Part 2XML Schema Part 2
XML Schema Part 2
 
XML Schema Part 1
XML Schema Part 1XML Schema Part 1
XML Schema Part 1
 
Rendering XML Document
Rendering XML DocumentRendering XML Document
Rendering XML Document
 
Pengantar XML
Pengantar XMLPengantar XML
Pengantar XML
 
Pengantar XML DOM
Pengantar XML DOMPengantar XML DOM
Pengantar XML DOM
 
Pengantar ADO.NET
Pengantar ADO.NETPengantar ADO.NET
Pengantar ADO.NET
 
Database Connectivity with JDBC
Database Connectivity with JDBCDatabase Connectivity with JDBC
Database Connectivity with JDBC
 
XML - Displaying Data ith XSLT
XML - Displaying Data ith XSLTXML - Displaying Data ith XSLT
XML - Displaying Data ith XSLT
 
Algorithm & Data Structure - Algoritma Pengurutan
Algorithm & Data Structure - Algoritma PengurutanAlgorithm & Data Structure - Algoritma Pengurutan
Algorithm & Data Structure - Algoritma Pengurutan
 
Algorithm & Data Structure - Pengantar
Algorithm & Data Structure - PengantarAlgorithm & Data Structure - Pengantar
Algorithm & Data Structure - Pengantar
 
Object Oriented Programming - Constructors & Destructors
Object Oriented Programming - Constructors & DestructorsObject Oriented Programming - Constructors & Destructors
Object Oriented Programming - Constructors & Destructors
 
Object Oriented Programming - Abstraction & Encapsulation
Object Oriented Programming - Abstraction & EncapsulationObject Oriented Programming - Abstraction & Encapsulation
Object Oriented Programming - Abstraction & Encapsulation
 
Web Programming Syaria - Pengenalan Halaman Web
Web Programming Syaria - Pengenalan Halaman WebWeb Programming Syaria - Pengenalan Halaman Web
Web Programming Syaria - Pengenalan Halaman Web
 
Web Programming Syaria - PHP
Web Programming Syaria - PHPWeb Programming Syaria - PHP
Web Programming Syaria - PHP
 
Software Project Management - Project Management Knowledge
Software Project Management - Project Management KnowledgeSoftware Project Management - Project Management Knowledge
Software Project Management - Project Management Knowledge
 
Software Project Management - Proses Manajemen Proyek
Software Project Management - Proses Manajemen ProyekSoftware Project Management - Proses Manajemen Proyek
Software Project Management - Proses Manajemen Proyek
 
Software Project Management - Pengenalan Manajemen Proyek
Software Project Management - Pengenalan Manajemen ProyekSoftware Project Management - Pengenalan Manajemen Proyek
Software Project Management - Pengenalan Manajemen Proyek
 

Recently uploaded

Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCzechDreamin
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...CzechDreamin
 
The architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdfThe architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdfalexjohnson7307
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka DoktorováCzechDreamin
 
Intelligent Gimbal FINAL PAPER Engineering.pdf
Intelligent Gimbal FINAL PAPER Engineering.pdfIntelligent Gimbal FINAL PAPER Engineering.pdf
Intelligent Gimbal FINAL PAPER Engineering.pdfAnthony Lucente
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKUXDXConf
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsStefano
 
Transforming The New York Times: Empowering Evolution through UX
Transforming The New York Times: Empowering Evolution through UXTransforming The New York Times: Empowering Evolution through UX
Transforming The New York Times: Empowering Evolution through UXUXDXConf
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyUXDXConf
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Julian Hyde
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutesconfluent
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomCzechDreamin
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupCatarinaPereira64715
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераMark Opanasiuk
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
 
Motion for AI: Creating Empathy in Technology
Motion for AI: Creating Empathy in TechnologyMotion for AI: Creating Empathy in Technology
Motion for AI: Creating Empathy in TechnologyUXDXConf
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxJennifer Lim
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀DianaGray10
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...CzechDreamin
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024Stephanie Beckett
 

Recently uploaded (20)

Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
The architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdfThe architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdf
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
Intelligent Gimbal FINAL PAPER Engineering.pdf
Intelligent Gimbal FINAL PAPER Engineering.pdfIntelligent Gimbal FINAL PAPER Engineering.pdf
Intelligent Gimbal FINAL PAPER Engineering.pdf
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
Transforming The New York Times: Empowering Evolution through UX
Transforming The New York Times: Empowering Evolution through UXTransforming The New York Times: Empowering Evolution through UX
Transforming The New York Times: Empowering Evolution through UX
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Motion for AI: Creating Empathy in Technology
Motion for AI: Creating Empathy in TechnologyMotion for AI: Creating Empathy in Technology
Motion for AI: Creating Empathy in Technology
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 

Network Socket Programming with JAVA

  • 1. Q7M1 – SC Dudy Fathan Ali S.Kom Network Socket Programming Q7M1 Dudy Fathan Ali, S.Kom (DFA) 2017 CEP - CCIT Fakultas Teknik Universitas Indonesia
  • 2. Consider this scenario.. Q7M1 – SC Dudy Fathan Ali S.Kom Hello, I want a pizza. Guys, bob wants a pizza! Bob Pizza Store
  • 3. Consider this scenario.. Q7M1 – SC Dudy Fathan Ali S.Kom Pizza Store Standard Operational Procedure
  • 4. Hmm.. Q7M1 – SC Dudy Fathan Ali S.Kom
  • 5. Client/Server Architecture Q7M1 – SC Dudy Fathan Ali S.Kom Bob [Client] Pizza Store [Server] The client places a request or order to the server. The server processes the request of the client The communication between the client and the server is usually through a network. The Client/Server model is an application development architecture designed to separate the presentation of data from its internal processing and storage.
  • 6. Client/Server Architecture Q7M1 – SC Dudy Fathan Ali S.Kom Pizza Store The processing that is done by the server is hidden from the client.
  • 7. Client/Server Architecture Q7M1 – SC Dudy Fathan Ali S.Kom Steve Bob John One server can service multiple clients.
  • 8. Client/Server Architecture Q7M1 – SC Dudy Fathan Ali S.Kom The server and the client are not necessarily hardware components. They can be programs working on the same machine or on different machines.
  • 9. Internet Protocol Q7M1 – SC Dudy Fathan Ali S.Kom The Internet Protocol (IP) is the principal communications protocol in the Internet protocol suite for relaying datagrams across network boundaries. Its routing function enables internetworking, and essentially establishes the Internet. -- Source: wikipedia.org -- Source: google.com
  • 10. Internet Protocol Q7M1 – SC Dudy Fathan Ali S.Kom implicit rules in conversation?
  • 11. Internet Protocol Q7M1 – SC Dudy Fathan Ali S.Kom o Data is sent from one machine to another in form of packets. o Rules govern packaging of data into packets, speed of transmission, and reassembling of data into its original form. o These rules are called network protocols. Communication rules between computers
  • 12. IP Address & Port Q7M1 – SC Dudy Fathan Ali S.Kom
  • 13. IP Address & Port Q7M1 – SC Dudy Fathan Ali S.Kom The TCP protocol requires two data items: the IP address and the port number. 172.17.8.192 : 80 IP Address Port o Well-known ports o Registered ports o Dynamic/Private ports
  • 14. IP Address & Port Q7M1 – SC Dudy Fathan Ali S.Kom IP Addresses of Popular Websites
  • 15. Sockets Q7M1 – SC Dudy Fathan Ali S.Kom Sockets are used to handle the communication links between applications over the network. Further communication between the client and the server is through the socket. -- Source: NIIT Courseware Q7M1
  • 16. Java Classes for Network Programming Q7M1 – SC Dudy Fathan Ali S.Kom o The java.net package of the Java programming language contains classes and interfaces that provide support for networking. o Networking classes contain methods to perform tasks, such as opening and closing a connection to remote machine, sending and receiving data packets and accessing resources on the Web.
  • 17. Java Classes for Network Programming Q7M1 – SC Dudy Fathan Ali S.Kom Classes of the java.net Package: o DatagramPacket o Represents a datagram packet. o DatagramSocket o Represents a datagram socket object that can send and receive datagram packets. o MulticastSocket o Creates a multicast datagram socket object that is used to send and receive datagram packets to groups. o InetAddress o Represents an IP address. o ServerSocket o Represents a TCP/IP server socket object that receives connection requests from the clients.
  • 18. Java Classes for Network Programming Q7M1 – SC Dudy Fathan Ali S.Kom The InetAddress Class: o Represents an IP address. o Contains the following static methods to initialize InetAddress objects: o public static InetAddress getLocalHost() o public static InetAddress getByName(String host) o public static InetAddress[] getAllByName(String host)
  • 19. Java Classes for Network Programming Q7M1 – SC Dudy Fathan Ali S.Kom The non-static methods of the InetAddress class are: o public boolean equals(Object obj) o public byte[] getAddress() o public String getHostAddress() o public String toString()
  • 20. Java Classes for Network Programming Q7M1 – SC Dudy Fathan Ali S.Kom Code Example: Result: Returns an InetAddress object that contains the IP address of the local computer. Returns the IP address of the InetAddress object as a String.
  • 21. TCP vs UDP Q7M1 – SC Dudy Fathan Ali S.Kom
  • 22. TCP vs UDP Q7M1 – SC Dudy Fathan Ali S.Kom
  • 23. Creating Application Using UDP Q7M1 – SC Dudy Fathan Ali S.Kom o UDP is a fast, connectionless, and unreliable protocol. o UDP sockets use UDP protocol for communication over a network. o The java.net package provides the following two classes that enable you to implement UDP sockets in a Java application: o DatagramPacket class o DatagramSocket class o The DatagramPacket object is a data container that consists of datagram packets that are sent or received over the network. o The constructor used to initialize DatagramPacket objects are: o public DatagramPacket( byte[] buffer, int buffer_length) o public DatagramPacket( byte[] buffer, int buffer_length, InetAddress address, int port)
  • 24. Creating Application Using UDP Q7M1 – SC Dudy Fathan Ali S.Kom o DatagramSocket class encapsulates the functionality to handle DatagramPacket objects. o The constructors used to initialize DatagramSocket object are: o public DatagramSocket() o public DatagramSocket(int port) o public DatagramSocket(int port, InetAddress address)
  • 25. Creating Application Using UDP Q7M1 – SC Dudy Fathan Ali S.Kom Code Example [DataSender]:
  • 26. Creating Application Using UDP Q7M1 – SC Dudy Fathan Ali S.Kom Code Example [DataReceiver]:
  • 27. Demonstration-Implementing UDP Q7M1 – SC Dudy Fathan Ali S.Kom Create a Client/Server application where the server can broadcast messages to all the clients of 233.0.0.1 group.
  • 28. Q7M1 – SC Dudy Fathan Ali S.Kom Thank You! Dudy Fathan Ali, S.Kom dudy.fathan@eng.ui.ac.id