Вы находитесь на странице: 1из 19

Internet Mail Server

Project Intro

Mail natter
Java jargon
Socket entropy
Server and Client design

Mail natter
Mailing is the transmission of messages
between the persons through any media.
In this project the transmission of
messages is possible between the clients
and the server.
Advantages of implementing this project is
the people are connected to one another to
communicate between them provided they
are working in the Lan Environment

Java jargon
Java is an object-oriented programming language
developed by Sun Microsystems that plays to the
strengths of the Internet .
In oop, a computer program is considered to be a
group of objects that interact with each other.
A java program is created as text files with the
files extension .java, it is complied into one or
more files of byte codes with the extension
Byte code is a set of instruction similar to
the machine code instruction created when a
computer program is complied. The
difference is that machine code must run on
the computer system it was compiled for;
byte code can run on any computer system
equipped to handle java programs.
Java is platform independent
Platform independent is another way of
saying that java is architecture neutral.
Most computers software is developed
for a specific operating system. Platform
independence is the ability of the same
program to work on different operating
system; java is completely platform
Networking in Java
Javas important feature is network-centric
nature. Java makes it possible to create
application that communicates across the
Internet. And other feature is multithreaded
Many operating system are Multitasking.
URL s and URL connection s provide a
relatively high-level mechanism for
accessing resources on the internet.
Programs require lower-level network
communication for example when you what
to write a program based on CLIENT and
Socket entropy
A SOCKET is one endpoint of a two-
way communication link between two
programs running on network. A
socket bounded to a port number so
that the TCP layer Can identify the
application that data is destined to be
The client and server can now
communicate by writing to or reading
from their socket
Request from the client
A server runs on a specific computer and
has a socket that is bounded to a specific
port number. The server just waits,
listening to the socket for a client to make
a connection request.
On the client side: The client knows the
hostname of the machine on which the
server is running and the port number to
which the server is connected.
Reply from the Server
The server accepts the connection. Upon
acceptance, the server gets a new socket
bound to different port. It needs a new socket
,so that it can continue to listen to the original
socket for connection request while tending to
the needs of the connected client.
Server Design
server = new ServerSocket( 5050, 100 );

This statement in Java creates an object of
ServerSocket with the port number 5050 and the
buffer size of 100 addresses.
output = new
input = new
ObjectInputStream(connection.getInputStream() );
The output and input are the objects
created for ObjectOutputStream and
ObjectInputStream classes respectively.
The method output.writeObject(string) will
write the message to the socket and the
method input.readObject() will return the
string object read from the socket.
Functions used in the server
Used to accept the requests from the
clients and read the messages received
from the clients
Used to write the message to client
using output.writeObject(string).
Whenever the message is typed in the
textbox and pressed enter key
Client Design
Socket client;
client = new Socket( InetAddress.getByName(
"" ), 5050 ))
The above statements are used to connect to
the specified servers InetAddress and with the
port number 5050.
Functions used in the client
This method is used to establish the connection
with the server and then to read the messages from
the server and write the messages to the server so
that the communication takes place.
Used to write the message to server using
output.writeObject(string). Whenever the message is
typed in the textbox and pressed enter key the
message will be sent to the server.