Title: Java Networking(I)
1Java Networking(I)
2Overview
- Java is a very good choice for networking
programming. - Client
- Socket
- Applet
- Java Web Start
- Java Network Launch Protocol
3Overview(cont.)
- Server
- ServerSocket
- Servlet
- JSP
- Client Server
- RMI
- EJB
- Soap
- Web Service
4Why Java Networking?
- Java is very suitable for network programming for
the following reason - Richness
- As previously discussed, we have many
java-technologies for network programming. - Simplicity
- Traditionally, we use Berkerly socket for network
programming, it is very complex, e.x., we will
show an example to connect to network
5Why Java Networking?(cont.)
With traditional socket library
familyAF_INET connectionSOCK_STREAM
socketidsocket(family,connection,IPPROTO_TCP) st
ruct hostent hp sockaddr1.sin_familyAF_INET
if(address0gt'1' address0lt'9'
address1gt'0' address1lt'9')
sockaddr1.sin_addr.s_addrinet_addr(address) conn
ect(socketid,(struct sockaddr )(sockaddr1),sizeo
f(sockaddr1))
With java
Socket socketnew Socket(address,port)
6Why Java Networking?(cont.)
- I/O functionality
- Java has great power in I/O,and network
transmitting is just an I/O operation
7Why Java Networking?(cont.)
- Naming ability
- There is an API called JNDI which is used for
searching remote objects. This is very important
for distributed computing, an important issue for
network programming. - Platform independence
- This is also very important for distributed
computing, since programs written on different
platforms can co-work together easily.