project report server)

58
MAIL SERVER 1

Upload: bhawna-grover

Post on 07-Apr-2015

262 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Project Report Server)

MAIL SERVER

1

Page 2: Project Report Server)

MAIL SERVER

SUBMITTED TO : SCDL PUNE

In partial fulfillment of the requirement for the degree of Post Graduate Diploma In Information Technology (2007)

Submitted By: Bhawna Grover

FEEDBACK FORM

Excellent Good Satisfactory

1) User friendliness

2) Data management

3) Presentation technique

Comments / Suggestions (if any)________________________________________________________________________________________________________________________________________________________________________________________________

2

Page 3: Project Report Server)

________________________________________________________________________

Name of the person:

Date:

3

Page 4: Project Report Server)

ACKNOWLEDGEMENT

I would like to take this opportunity to express our gratitude towards all the people who in various ways have helped in successful completion of this project. At the outset I would like to thank Symbiosis Centre of Distance Learning for giving me the opportunity and means to undertake this project.

I would like to thank all the faculty members of Symbiosis Centre of Distance Learning for adding value to our project. Last but not the least we would like to thank all of my friends for their moral support.

Bhawna

4

Page 5: Project Report Server)

TABLE OF CONTENTS

1. INTRODUCTION 9

2. SYSTEM DEVELOPMENT LIFE CYCLE 11

3. SYSTEM REQUIREMENTS SPECIFICATION 13

4. OBJECTIVES 17

5. USE CASE DIAGRAM 19

6. DATA FLOW DIAGRAMS 21

7. BASIC THEORY 27

8. WORKING OF MAIL SERVER 29

9. EXECUTION 31

10. DETAILED WORKING 33

11. OUTPUT 38

12. ADVANTAGES & DISADVANTAGES 52

13. USER MANUAL 54

14. CONCLUSIONS 57

15. APPENDIX 59

16. BIBLIOGRAPHY 61

5

Page 6: Project Report Server)

INTRODUCTION

6

Page 7: Project Report Server)

INTRODUCTION

With the explosive growth of the Internet and it’s increasingly important role in our lives, the traffic on the Internet is increasing dramatically, which has been growing at over 100% annual rate. The workload on the servers is increasing rapidly so that servers will be easily overloaded for a short time, especially for a popular web server. To overcome the overloading problem of the servers, there are two solutions. One is the single server solution, i.e. to upgrade the server to a higher performance server, but it will soon be overloaded when requests increases so that we have to upgrade it again, the upgrading process is complex and the cost is high. The other is the multi-server solution, i.e. to build a scalable server on a cluster of servers. When load increases, we can simply add a new server or more into cluster to meet the increasing requests.

Mail server is a highly scalable and highly available server built on a cluster of real servers. The architecture of the cluster is transparent to end users, and the users see only a single mail server. The real servers may be interconnected by high-speed LAN or by geographically dispersed WAN. The front-end of the real servers is a load balancer, which schedules requests to the different servers and make parallel services of the cluster to appear as a virtual service on a single IP address. Scalability is achieved by transparently adding or removing a node in the cluster. High availability is provided by detecting node or daemon failures and reconfiguring the system appropriately.

7

Page 8: Project Report Server)

SYSTEM DEVELOPMENT LIFE CYCLE

8

Page 9: Project Report Server)

SYSTEM DEVELOPMENT LIFE CYCLEThe process of software development is a step-by-step process each step having its own importance. The time required to develop a process is distributed among these steps. The model I used is the waterfall model, which is given in the figure given below:

9

Page 10: Project Report Server)

SYSTEM REQUIREMENTS SPECIFICATION

10

Page 11: Project Report Server)

SYSTEM REQUIREMENTS SPECIFICATION

Purpose

The basic purpose of this Project is to:

Produce a high-performance and highly available server for based on clustering, which provides a good scalability, reliability and serviceability.

Scope

Since this mail server is based on UNIX , it is more secure , supports multiple users and works in a transparent manner . Certain new features like mail forwarding , spam protection , storing mails as drafts can be added by simply adding new classes . This mail server is user friendly and requires user to have some knowledge of working with UNIX and is very efficient to be used in many organizations

11

Page 12: Project Report Server)

The Overall Description 

Problem Statement

Developing a MAIL SERVER for pc to pc communication using socket programming, providing all the facilities including Login, registering, inbox, sent box, loging out, etc.

Product Perspective 

The requirement analysis for this software was divided into various sections. These sections were analyzed by me according to the various perspectives. The section are different for mail server program and different client program.

Users perspective

Developer Perspective

Functional Perspective

Goals

The basic goal of the Mail Server Project is to:

Produce a high-performance and highly available server which provides a good scalability, reliability and serviceability

Memory Constraints

MAIL SERVER will work with 128MB of RAM.

12

Page 13: Project Report Server)

Minimum Hardware Requirements

Pentium II 255 MHz Input devices (Monitor, Keyboard and Mouse)

Tools, Modules and Platform Tools: C Modules: MS WORD Platform: UNIX

Software Requirements Linux based multiple client mail server. Registering facility for the new user. Client to client mail communication. Checking new mails. Composing mails. Shows number of new mails received when the user logs on. Unsubscribing facility if the user doesn’t want to continue with the mail facility. Saving and sending mails to desired destination. Shows NEW and OLD status for new and old mails respectively in the inbox. Shows error if fails in sending mails to the desired destination.

13

Page 14: Project Report Server)

OBJECTIVES

14

Page 15: Project Report Server)

OBJECTIVES

1: Modular design of code. The code is completely divided into two separate files.

2: Make file for both client as well as server side.

3: Socket-Select combination for handling multiple clients.

4: Proper synchronization of SEND and RECV system calls as each send is followed by recv.

5: Proper headers enable signals received at the server to be completely independent of any previous signal.

15

Page 16: Project Report Server)

USE CASE DIAGRAM

16

Page 17: Project Report Server)

USE CASE DIAGRAM

user

Register

Mail Server

Exit

Check Mail Send Mail Logout

Login

Unsubscribe

17

Page 18: Project Report Server)

DATA FLOW DIAGRAMS

18

Page 19: Project Report Server)

DATA FLOW DIAGRAMSLEVEL 1

User ID

User ID and Password

User ID and Password

User Id and Password

User ID & User ID and Password Password

User information File Mail Boxes

Mail data Mail Data

Command and data

USER

REGISTER LOGIN UNSUBSCRIBE

Send MailsRetrieve Mails

User

19

Page 20: Project Report Server)

LEVEL 2

Send Mail To User

Commands Invalid

And Data

User ID of

Replies Mail Recipient

Data

Valid

Buffers

Data

Mail Data

File Id

Mailboxes Count File

Level 2 Data Flow Diagram

User

InteractWithUser

ValidateUser ID

Store mail data InAppropriateMailboxes

20

Page 21: Project Report Server)

Mail Retrieval

Commands Information corresponding and Data

to the commands

Replies

User Information User ID MailFile and Data

Password Mailboxes

UserInformation User ID

Level 2 Data Flow Diagram

User

InteractWithUser

InteractWithUser

ProcessPassword

21

Page 22: Project Report Server)

Register new User

User Information File

User ID User InformationAnd Password

Reply

UserInformation

User IDInvalid Valid and

Password

Level 2 Data Flow Diagram

User

ValidateUser ID and

Password

AddUser ID and

Password

Send Appropriate

Reply

22

Page 23: Project Report Server)

Unsubscribe User

User Information File

User ID User Information

reply

UserInformation

User IDInvalid Valid

Level 2 Data Flow Diagram

User

ValidateUser ID and

Password

Delete UserInformation

Send Appropriate

Reply

23

Page 24: Project Report Server)

BASIC THEORY

24

Page 25: Project Report Server)

BASIC THEORY

A Server application creates a socket, which is just an operating system resource assigned to the server process. As the server creates it using the system call socket, other processes can't access it.

Next, the server process gives the socket a name. Local sockets are given a file name in the UNIX file system, often to be found in tmp or/usr/tmp. For network sockets, it will be a service identifier (port number / access point) relevant to the particular network to which the clients can connect. A socket is named using the system call bind. The service process then waits for clients to connect to the named socket. The system call, listen, creates a queue for incoming connections. The server can accept them using the system call accept.

When the server calls accept, a new socket is created, distinct from the named socket. The new socket is used solely for communication with this particular client. The named socket remains for further connections for other clients. If the server is written appropriately, it can take advantage of multiple connections. For a simple server, further clients wait on the listen queue until the server is ready again.

The client side of a socket-based system is more straightforward. The client creates an unnamed socket by calling socket. It then calls connect to establish a connection with the server by using the server's named socket as an address.

Once established, sockets can be used like low-level file descriptors, providing tow-way data communication.

25

Page 26: Project Report Server)

WORKING OF MAIL SERVER

26

Page 27: Project Report Server)

WORKING OF MAIL SERVER

1. Socket is created in both client and server for the communications between the two of them. The system call being used is socket.

2. Inside the server socket is named using bind system call.

3. Inside the server a system call listen keeps track of waiting clients.

4. The select system call determines the system calls made by the clients so that server can communicate with clients using file descriptors for each of them.

5. The clients connect to the server using the connect system call.

6. Inside the server, server using the accept system call creates a new file descriptor for communication with the client.

7. Basic communication thus has been established and using file descriptions we can further communicate using read and write system call.

27

Page 28: Project Report Server)

EXECUTION

28

Page 29: Project Report Server)

EXECUTION

1. First the user makes a choice between REGISTER and LOGIN.

2. New user can register him/her only once he selects the REGISTER.

3. Every user is given his/her own specific user NAME and PASSWORD for convenience and security reasons.

4. Once the user gets his/her user name he can select the LOGIN.

5. The user can then checks, or compose his/her mails as per convenience by selecting the LOGIN.

6. Once the user has performed the desired operation on his/her mails he can exit out of the system by selecting EXIT.

29

Page 30: Project Report Server)

DETAILED WORKING

30

Page 31: Project Report Server)

DETAILED WORKING

When server is executed in the background then a password file & a User directory is created.

When client is executed user gets the following options:

1: Register2: Login3: Exit

I: REGISTER

This facility allows the new user to register himself on the server. It checks if the user name already exists.

a) User is first prompted for user name and password.

Clienta.c.1) Client sends this information to the server in the following format send (fd,"Uname:Username:Password",size,0);

Here Uname: is the header for Registeringa.c.2) Client receives the result of the request & then it displays the failure or success of the request.

Servera.s.1) Server accepts the request send by the client. Then it passes it to get the required information. After that it checks if user exists or not. If user exists it sends Success otherwise responds by Failure. Creating required folders & entry in the password file for the user completes successful registration.

31

Page 32: Project Report Server)

II. LOGIN

This option enables user to login to the mail services.

a) User is first prompted for user name & password. After validation user gets the following options:

1) Inbox2) Compose3) Sent Box4) Logout5) Unsubscribe

a.1) INBOX

This folder stores the received messages.

Client

a.c.1) Now client sends request of the following type in order to obtain information like subject, sender’s name & status of all the mails in the inbox folder: send(fd,”Imail:Username:category:flleno”,size,0);

where Imail : a header category: Inbox or Sentbox

a.c.2) Now information received is displayed to the user in tabular format so that he could select the mail to be read.

a.c.3) Now when user selects a particular mail in order to read it then client sends a request of the following type: send(fd,”Rmail:Username:category:flleno:lineno”,size,0);

where Rmail: a header lineno: line to be read from mail

Server

a.s.1) When server receives request for receiving information like subject , status… . Then it gathers the information from the requested fileno & replies in the following format: send(fd,”status:subject:senderaddress,size,0)

a.s.2) When server receives request for reading a particular mail then it opens the requested mail & sends the requested line no of that mail to the client.

32

Page 33: Project Report Server)

a.2) COMPOSE This option helps user to create mail.

Client

a.c.1) Here user is first prompted to enter the receiver’s address & subject. Then user composes the whole mail. This mail is temporarily stored on the client machine with the header ‘Smail’ added to each line of the mail. Then user is asked to send this mail with or without sending a copy of it to the client’s own Sent Box. This is done by the following requests:

1) send(fd,”Email:receiveraddress”,size,0) this signal is used to validate the receiver’s address2) send(fd,”Smail: line of the message “,size,0); this signal is used make a temporary mail at server’s machine3) send(fd,”email:Sender’s address:Receiver’s address:choice”, size,0); this signal notifies server where to save the temporary mail at

server’s machine

Here: choice determines whether mail is to be saved in sender’s Sent Box or not.

Server

a.s.1) Here server processes each request & sends notification to the client about success or failure of sending mail.

a.3) SENT BOX

This Folder stores the messages that were saved by the user while sending mails.

It’s working is similar to Inbox . Here category is set to Sent box.

a.4) LOGOUT

This option log outs the user from the mail services

33

Page 34: Project Report Server)

a.5) UNSUBSCRIBE

This option unsubscribe the user if he doesn't want to continue using mail services

Clienta.c.1) Here client sends the user’s information to the server in the following format:

send(fd,”Unsub:username”,size,0)

Servera.s.1) Now server receives the signal & removes all the folder’s of that user in the User directory. Also user’s entry from password file is removed to complete the unsubscribe process.

34

Page 35: Project Report Server)

OUTPUT

35

Page 36: Project Report Server)

36

Page 37: Project Report Server)

37

Page 38: Project Report Server)

38

Page 39: Project Report Server)

39

Page 40: Project Report Server)

40

Page 41: Project Report Server)

41

Page 42: Project Report Server)

ADVANTAGES&

DISADVANTAGES

42

Page 43: Project Report Server)

ADVANTAGES & DISADVANTAGES

The advantage of the mail servers is that they can run any operating system that supports TCP/IP protocol, real servers can use private Internet addresses, and only an IP address is needed for the load balancer.

The disadvantage is that the scalability of the mail server is limited. The load balancer may be a bottleneck of the whole system when the number of server nodes (general PC servers) increase to around 20 or more, because both the request packets and response packets are need to be rewritten by the load balancer. Supposing the average length of TCP packets is 536 Bytes, the average delay of rewriting a packet is around 60us (on Pentium processor, this can be reduced a little by using of higher processor), the maximum throughput of the load balancer is 8.93 MBytes/s. Assuming the average throughput of real servers is 400Kbytes/s, the load balancer can schedule 22 real servers.

43

Page 44: Project Report Server)

USER’S MANUAL

44

Page 45: Project Report Server)

USER’S MANUAL

This mail server is designed to provide the mail services among the members of this server only, i.e., mail can be send /received only to/from the members of this server.

Registering User

1. While registration, username should not contain any spaces & should be of maximum 9 characters. You don’t need to enter ‘@ass.com ‘ in the user name.

2. If you get a message “User already Exists” , then this means another user has already registered this username. So be innovative & try out with other names.

3. Remember Username and Password case sensitive.

Login

1. Now registered username & password should be entered only.

2. If you get an error ‘Invalid Password’ , this means either username or password is/are invalid/incorrect.

Options

Inbox:

1. Now user should get a display of his/her inbox folder. If no message is present then all fields will be empty.

2. If user select an invalid mail no. then he will get an empty mail. So for reading mails correctly make sure that mail no. is entered correctly from displayed mails.

3. Note that new mails are on the top of the list of displayed mails but as soon as they are read it comes to the end of the displayed list.

Compose:

1. Now user should remember to end sender’s address with ‘@ass.com’ with no spaces in between.

2. The mail’s message body should be ended with ‘ENDMAIL’ in the starting of a blank new line.

3. While sending mail if you receive an error this means sender’s address was invalid and if no error this means mail has been successfully sent.

45

Page 46: Project Report Server)

Sent Box:

1. Now user should get a display of his/her sent box folder. If no message is present then all fields will be empty.

2. If user select an invalid mail no. then he will get an empty mail. So for reading mails correctly make sure that mail no. is entered correctly from displayed mails.

Logout:This option simply logouts user without any prompting

Unsubscribe:This option simply unsubscribe user without prompting . Once user is unsubscribed his/her whole account is deleted & user can not regain his/her previous mails.

46

Page 47: Project Report Server)

CONCLUSION

47

Page 48: Project Report Server)

CONCLUSION

The field of computer software as it has developed till date has surely become efficient enough so that such a system could be developed which could be used mailing purpose. The prime requirements of such software would surely be cost effectiveness, accuracy and efficiency. Mail server comes with its own package of advantages.

The control of such an automated mail server need not be in the same physical location i.e., it could be easily installed in some other building complex.

With the project being presented here a beginning is being made towards this end by developing a model of Linux mail server. As this is the beginning so this project may not be as advanced.

48

Page 49: Project Report Server)

APPENDIX

49

Page 50: Project Report Server)

APPENDIX

UNIX

UNIX, in computer science, is a multi-user, user i.d. operating system that incorporates multitasking. Linux exists in various forms and implementations and is considered a powerful operating system that is more portable—less machine-specific—than other operating systems because it is written in C. It has several features that allow the programmer to develop applications in an easy and efficient manner.

C

C is an object oriented programming language which is used to build various applications. An object is an instance of a class that can be used as a variable in a program. It can be used to define a sequence of instructions that can ultimately be processed and executed by the computer. At a low level of description, microprocessors deal exclusively with binary electronic signals. Giving an instruction to a microprocessor really involves sending it a carefully timed series of on and off signals. This sequence of signals is called machine code.

MS WORD It is to manipulating text-based documents; the electronic equivalent of paper, pen, typewriter, eraser, dictionary, and thesaurus. MS Word run the gamut from simple through to complex, but they all ease the tasks associated with editing documents (deleting, inserting, rewording, and so on). Depending on the program and the equipment in use, word processors can display documents either in text mode, using highlighting, underlining, or colour to represent italics, boldfacing, and other formatting where a variety of fonts appear on the screen as they will on the printed page. All word processors offer facilities for document formatting, such as font changes, page layout, paragraph indention, and the like. Many word processors can also check spelling, find synonyms, incorporate graphics created with another program, correctly align mathematical formulas, create and print standard letters, perform calculations, display documents in multiple on-screen windows, and enable users to record macros that simplify difficult or repetitive operations.

50

Page 51: Project Report Server)

BIBLIOGRAPHY

51

Page 52: Project Report Server)

BIBLIOGRAPHY

1.THE UNIX PROGRAMMING ENVIRONMENT BY BRIAN W. KERNIGHAN2.OBJECT ORIENTED PROGRAMMING IN C++ BY E BALAGURUSAMY

3.LET US C BY YASHWANT KANITKAR 4.PROGRAMMING IN C++ BY BRYON GOTTERFRIED 5.WWW.GOOGLE.COM 6.WWW.HOTBOT.COM

7. WWW.ENCYCLOPEDIA.COM

52