Lect01 - What Can A Network Program Do

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 34

IN 4110 - Network Programming

Dive the Net !


Better Understand IPC !!
CODE 4 communication o’er the Net !!!

Ransara Wijethunga
Tech. Lead
Millennium IT
2016 – 07 - 23
2
What you will miss !

3
Course Content
L 01 What Can a Network Program Do July 23
L 02 Networking Concepts (Recap) July 30
L 03 Sockets Concepts , Address Lookup Aug 06
L 04 TCP Socket Programming Aug 13
L 05 UDP Socket Programming Aug 20
L 06 Multicasting Aug 27
L 07 HTML in Java Network Programming Sep 03
L 08 Threads Sep 17
L 09 Thread Pools Sep 24
L 10 Network Programming in C Oct 01
L 11 Network Traffic Analysis with Wireshark Oct 08
L 12 Secure Sockets (in Java) Oct 15
L 13 Network Programming with Java Non Blocking IO Oct 22
L 14 Remote Method Invocation Oct 29
4
References / Recommended Textbooks

 Java Network Programming – 3rd Ed.


◦ Elliotte Rusty Harold

 Unix Network Programming – Vol2 2nd Ed.


◦ W. Richard Stevens

5
Assignments
 Final Marks
◦ 30 % Assignments ( 3 Assignments + 1 or 2 )
◦ 70 % Semester End Exam
◦ No mid semester test
◦ In-class tests ( your choice ? )

 Do the assignments in the lab.


◦ Instructors will mark
◦ Suggestions ?

 No hard copies
6
Attendance
 University / Faculty rules and regulations
apply.

 Can adjust the lecture schedule for critical


project deliverables / assignments /
important events.
( Max 2 times for the semester )

 This is your course !!


( It is you who learns or not ! )
7
IN 4110 - Network Programming

Lect. 01 - What Can a Network


Program Do?

Ransara Wijethunga
Tech. Lead
Millennium IT
2016 – 07 - 23
Motivation….

9
Why this subject ?
 Majority of programs are network aware.

 Examples:
◦ Text editors save and open files directly from FTP
servers
◦ IDEs like Eclipse and IntelliJ IDEA communicate
with CVS repositories
◦ Word processors like Microsoft Word open files
from URLs
◦ Antivirus programs like Norton Anti Virus check
for new virus definitions by connecting to the
vendor’s web site every time the computer is
started. 10
Programs are network aware…
 Examples (cont.)

◦ Multiplayer games on internet


◦ Supermarkets updating their store servers
real-time
◦ Schedule applications like Microsoft Outlook
automatically synchronize calendars with
other employees in the company

11
Why Java for Network Programming ?
 Java is the first programming language designed
from the ground up with networking in mind.
 Java was originally designed for proprietary
cable television networks rather than the
Internet, but it’s always had the network
foremost in mind

 Java provides solutions to a number of


problems
◦ Platform Independence
◦ Security
12
Next ….

1. What Can a Network Program Do?

2. Security

13
What Can a Network Program Do?

Web
Search
Peer-to-
Servers /
Peer
Services
Interaction

Send Data

Retrieve E-
Data Commerce

Ubiquitous Interactive
Computing TV

14
What Can a Network Program Do?
 Retrieve Data
 Send Data
◦ File storage / Massively parallel computing
 Peer-to-Peer Interaction
◦ Games / Chat / File sharing
 Servers / Services
 Web Search
 E-Commerce
 Ubiquitous Computing
 Interactive Television
15
Retrieve Data

 Retrieve data from a server far away.


◦ Eg: Requesting a web page.

 At the most basic level, a network client retrieves data


from a server. It can format the data for display to a
user, store it in a local database, combine it with other
data sources both local and remote, analyze it, or all of
the above. Network clients written in Java can speak
standard protocols like HTTP, FTP, or SMTP to
communicate with existing servers written in a variety
of languages. 16
Send Data
 Web Browsers are mainly for
downloading data.Very less uploading data
(mainly via forms).

 Java programs have no such limitations.


Once a connection between two
machines is established, Java programs can
send data across the connection just as
easily as they can receive from it.
17
Send Data – File Storage
 Your program can send your data to a
server far away.

 Programs (and Java Applets as well) can store data on a


cooperating server. The applet just opens a network
connection to the host it came from and sends the data
to it. The host may accept the data through HTTP POST,
FTP, SOAP, or a custom server or servlet.
 Untrusted applets aren’t allowed to write files on local
disks.

18
Send Data –
Massively parallel computing

19
Send Data –
Massively parallel computing

 Imagine !
◦ You got massive amount of data from the “Hubble
Space Telescope”

◦ You are going to search for a planet like earth !!

◦ How you are going to process the data ?

◦ P1 ? PII ? PIV ??? Super Computer ? ????

20
Send Data – Massively Par. Comp.
 Massively parallel Computing refers to the use of a large number of
processors (or separate computers) to perform a set of coordinated
computations in parallel.

 Approach 1 => “Grid Computing”, the processing power of a large


number of computers in distributed, is opportunistically used whenever a
computer is available.
Eg: BOINC, a volunteer-based opportunistic grid system.

 Approach 2 => A large number of processors are used in close proximity


to each other, in a computer cluster.
In such a centralized system the speed and flexibility of the
interconnect becomes very important, and modern supercomputers have
used various approaches ranging from enhanced Infiniband systems to three-
dimensional torus interconnects.
21
BOINC & SETI

22
Peer-to-Peer Interaction
 Applications (java or any other network
application) can talk to each other across
the Internet using Network Sockets,
opening up many new possibilities for
group applications.

 Games => Yahoo Multiplayer Games


 Chat => Jabber
 File Sharing => Lime Wire
23
24
Servers
 Java applications can listen for network
connections and respond to them, so it’s
possible to implement servers in Java.

 Many kinds of servers have been written in Java as well,


including IRC servers, NFS servers, file servers, print
servers, email servers, directory servers, domain name
servers, FTP servers, TFTP servers, and more. In fact,
pretty much any standard TCP or UDP server you can
think of has probably been ported to Java.

25
Web Search – Spiders & Agents
 Java programs can wander through the Web, looking for
crucial information. Search programs that run on a single
client system are called spiders. A spider downloads a page
at a particular URL, extracts the URLs from the links on that
page, downloads the pages referred to by the URLs, and
repeats the process for each page it downloads.

 The purposes of agents are similar to those of spiders


(researching a stock, soliciting quotations for a purchase,
bidding on similar items at multiple auctions, finding the
lowest price for a CD, finding all links to a site, and so on),
but whereas spiders run a single host system to which they
download pages from remote sites, agents actually move
themselves from host to host and execute their code on
each system they move to.

26
Ubiquitous Computing
 Networked devices don’t have to be
tied to particular physical locations,
subnets, or IP addresses. Jini is a
framework that sits on top of Java,
easily and instantly connecting all sorts
of devices to a network. For example,
when a group of coworkers gather for a
meeting, they generally bring a random
assortment of personal digital assistants,
laptops, cell phones, pagers, and other
electronic devices with them.
 If the coffee machine is empty, it sends
an email to supplies division for refilling.
27
Interactive Television
 The Java TV API sits on top of J2ME to add television-
specific features like channel changing and audio and
video streaming and synchronization.
 TV stations can send programs down the data stream
that allow channel surfers to interact with the shows.
 An infomercial for spray-on hair could serve a GUI
program that lets the viewer pick a color, enter their
credit card number, and send the order through the
cable modem and over the Internet using their
remote control.
 A news magazine could conduct a viewer poll in real
time and report the responses after the commercial
break. 28
Next ….

1. What Can a Network Program Do?

2. Security

29
Security
 Remotely loaded code cannot access arbitrary addresses in
memory. Unlike the other restrictions in the list, which are
enforced by a SecurityManager, this restriction is a property of
the Java language itself and the byte code verifier.

 Remotely loaded code cannot access the local filesystem. It


cannot read from or write to the local filesystem nor can it find
out any information about files. Therefore, it cannot find out
whether a file exists or what its modification date may be. (Java
WebStart applications can actually ask the user for permissions
to read or write files on a case-by-case basis.)

 Remotely loaded code cannot print documents. (Java WebStart


applications can do this with the user’s explicit permission on a
case-by-case basis.)

30
Security (cont.)
 Remotely loaded code cannot read from or write to the system
clipboard. (Java WebStart applications can do this with the user’s
explicit permission on a caseby- case basis.) It can read from and
write to its own clipboard.

 Remotely loaded code cannot launch other programs on the


client. In other words, it cannot call System.exec( ) or
Runtime.exec( ).

 Remotely loaded code cannot load native libraries or define native


method calls.

 Remotely loaded code may not define any system properties.


31
Security (cont.)
 Remotely loaded code may not create or manipulate any
Thread that is not in the same ThreadGroup.

 Remotely loaded code cannot define or use a new instance


of ClassLoader, SecurityManager, ContentHandlerFactory,
SocketImplFactory, or URLStream- HandlerFactory. It must
use the ones already in place.

 Remotely loaded code can only open network connections


to the host from which the code itself was downloaded.

 Remotely loaded code cannot listen on ports below 1,024.

 Even if a remotely loaded program can listen on a port, it can


only accept incoming connections from the host from which
the code itself was downloaded.
32
Question For Coming Week:

 What is meant by the acronym FUD in


network security ?

 In a Java network program, the client


program uses the CPU of
 Server machine ?
 Client machine ?

 What is SETI @ home ?


 Explain how you can contribute to this project.
33
Questions

 Try to solve by your self first !


“Do Google” or “Bing It” !!

 If failed, email me
◦ ransaraw@gmail.com

34

You might also like