473,573 Members | 2,909 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python vs C for a mail server

Hello guys,
I am a novice in python.I have to implement a full fledged mail server
..But i am not able to choose the language.Should i go for C(socket API)
or python for this project? What are the advantages of one over the
other in implementing this server.which language will be easier? What
are the performance issues?In what language are mail servers generally
written?

Jan 28 '06 #1
25 5725
On Fri, 27 Jan 2006 22:43:48 -0800, abhinav wrote:
Hello guys,
I am a novice in python.I have to implement a full fledged mail server
Because that's just what the world needs, yet another mail server.

Why don't you use an existing mail server?
.But i am not able to choose the language.Should i go for C(socket API)
or python for this project?
If you aren't able to choose the language, what does it matter what we
say? Somebody else will choose.

What are the advantages of one over the
other in implementing this server.
C can be faster.
which language will be easier?
Python is easier to read, and write, and debug, and you will have fewer
hard-to-debug memory issues.
What are the performance issues?
You will spend hundreds of man-hours re-inventing the wheel.

In what language are mail servers generally written?


Google is your friend. The first four mail servers listed are, in order:

sendmail
postfix
Microsoft Exchange
qmail

Of the four, source code is available free of charge for three of them.
Can you guess which is the odd man out? :-)
--
Steven.

Jan 28 '06 #2
>> Why don't you use an existing mail server?

Probably because that was his homework assignment for a networking
class. Not uncommon to be told to implement a server from the scratch
from the RFC. Although that does not explain his concern about
performance.

Abhinav, if that is the case, using sockets is more or less the same
from any language. Python as usual will be cleaner than C. You might
want to look at Twisted Mail. Use SocketServer module in the standard
library to implement the RFC. Other than that it is silly to try to
write a Mail Server unless you have some extra ordinary need.

Jan 28 '06 #3
>but i am not able to choose the language.Should i go for C(socket API)

Ravi is right
(>using sockets is more or less the same
from any language.)

...try JSP(java server pages), some guys in nit warangal implemented a
mail server
(foa LAN though)for their minor project.

my contention is that using sockets(in c++) will improve your
understanding of the protocol
suite and improve your programming as well.


Ravi Teja wrote:
Why don't you use an existing mail server?


Probably because that was his homework assignment for a networking
class. Not uncommon to be told to implement a server from the scratch
from the RFC. Although that does not explain his concern about
performance.

Abhinav, if that is the case, using sockets is more or less the same
from any language. Python as usual will be cleaner than C. You might
want to look at Twisted Mail. Use SocketServer module in the standard
library to implement the RFC. Other than that it is silly to try to
write a Mail Server unless you have some extra ordinary need.


Jan 28 '06 #4
In article <11************ *********@g43g2 000cwa.googlegr oups.com>,
Ravi Teja <we*********@gm ail.com> wrote:
Why don't you use an existing mail server?


Probably because that was his homework assignment for a networking
class. Not uncommon to be told to implement a server from the scratch
from the RFC. Although that does not explain his concern about
performance.

Abhinav, if that is the case, using sockets is more or less the same
from any language. Python as usual will be cleaner than C. You might
want to look at Twisted Mail. Use SocketServer module in the standard
library to implement the RFC. Other than that it is silly to try to
write a Mail Server unless you have some extra ordinary need.


Any lecturer assigning "write a mail server" as a class project is
doing his/her students a true dis-service. Mail server RFC compliance is a
nightmare to get right, performance issues and mail routeing are both
material for at least a full year's university study.

A student who tries to make an even vaguely RFC compliant mail server
probably won't finish their project, as student who completes such a
project might come away with the mistaken belief that they actually
have done it correctly.

The number of software products which use eail and do so incorrectly
is astounding and depressing. There's a reason that the source for
sendmail is about 120K lines, exim is nearly 270K lines. Doing it
right is _hard_.

--
Jim Segrave (je*@jes-2.demon.nl)

Jan 28 '06 #5
jim you are probably right.

i have had exp. with this. i had to create a server(multipur pose such
as file sharing, games (pretty simple tho like tic tac toe..) we were
in 6th sem with learning OS and comp. n/w for the first time.

it seems like these jack ass jerks (proffs/instuctors) like to bully
students...
obviously we cud not complete the project as most of the time was spent
on
learning the stuff(like TCP, multithreading. .) .

i don't know how things work out in the west, but i feel the faculty
really care about their students in american colleges..in contrast to
here (in inida, though things are little different in the IITs)
Jim Segrave wrote:
In article <11************ *********@g43g2 000cwa.googlegr oups.com>,
Ravi Teja <we*********@gm ail.com> wrote:
Why don't you use an existing mail server?


Probably because that was his homework assignment for a networking
class. Not uncommon to be told to implement a server from the scratch
from the RFC. Although that does not explain his concern about
performance.

Abhinav, if that is the case, using sockets is more or less the same
from any language. Python as usual will be cleaner than C. You might
want to look at Twisted Mail. Use SocketServer module in the standard
library to implement the RFC. Other than that it is silly to try to
write a Mail Server unless you have some extra ordinary need.


Any lecturer assigning "write a mail server" as a class project is
doing his/her students a true dis-service. Mail server RFC compliance is a
nightmare to get right, performance issues and mail routeing are both
material for at least a full year's university study.

A student who tries to make an even vaguely RFC compliant mail server
probably won't finish their project, as student who completes such a
project might come away with the mistaken belief that they actually
have done it correctly.

The number of software products which use eail and do so incorrectly
is astounding and depressing. There's a reason that the source for
sendmail is about 120K lines, exim is nearly 270K lines. Doing it
right is _hard_.

--
Jim Segrave (je*@jes-2.demon.nl)


Jan 28 '06 #6
ya its supposed to be some stupid 6 month project which my friend has
to do.I am just helping him out.he may not be implementing a full
fledged rfc compliance mail server but may support some of the major
functionalities .so basically its an extra ordinary need.I just wanted
to know which language would be better for implementation and has
faster development cycle.I have heard a lot about python and its ease
of use.My point is it should be worth a 6 month project and speedy
development since he is already proficient in C/C++ socket programming
and taking the pain of learning python should be worth the effort.

Jan 28 '06 #7
If your friend is proficient in C/C++ then learning Python should not
be a pain. Quite the contrary, it should be an enlightnement. Being
good in C/C++ AND Python is a killer combination, as you can promptly
and efficiently code big chunks of your application in Python and
interface with C/C++ code where (and if) high performance is required.

Now, you should definitely check the requirements for the homework.

If the assignment is about being able to decipher an RFC and implement
it correctly with a nice software design, then I would definitely opt
for Python. Having to squish memory management, string manipulation and
character encoding bugs in C/C++ is not fun and not related to
high-level design nor RFC support.

If it's just a way to throw a programming challenge at your friend's
face, then you should check whether it's okay to use Python rather than
C/C++, otherwise he could be charged of cheating by using a more
productive language :).

Regards,
Nicolas

Jan 28 '06 #8
Nicolas wrote:
If it's just a way to throw a programming challenge at your friend's
face, then you should check whether it's okay to use Python rather than
C/C++, otherwise he could be charged of cheating by using a more
productive language :).


Though this comment of mine is likely to start a religious war, it might
also bring up some useful points.

I'm a bit relucted to swallow the common view of Python being a so-
productive language, especially compared to C++. I value C++
productiveness actually much higher than it's performance.

To stick to the mailserver example, I'm pretty sure I'd do it in C++. I
got very exited about Python when I first saw it, but I've encountered
several problems that hindered productivity dramatically.

One thing is the lack of static types. The problem is not only that the
compiler can't tell you very basic things you're doing wrong but also that
code isn't intrinsically documented:

def send_mail(mail) :
...

What can I do with mail? In C++, you're looking up what type it is
(presumably by pressing M-x in Emacs on the word before it) and have a
look on it's type definition. In Python, it can be quite difficult to tell
what you can do with it because the information of what will be passed in
can be several layers up.

Also there is not even symbol-safety: self.not_define d will never rise a
compile-time error.

And to address the memory management critisism about C++: Unless you have
cyclic structures (you probably won't have in a mail server), just use
smart pointers and you don't have to be concerned more about it than you'd
have to be in Python.

I aggree on C++ libraries being weak on unicode strings though, or even
generally weak in the libraries (you have the C libraries, but they're not
very type safe or elegant to use).

I'm aware that C++ is a horrible monstrosity, an argument whiches weight
depends on the OP's friends C++ experience.

Please don't be offended, but if anyone could make a point of how Python's
disadvantages in these regards could be alleviated, I'd be very
interested.

Jens

Jan 28 '06 #9
Jim Segrave enlightened us with:
Any lecturer assigning "write a mail server" as a class project is
doing his/her students a true dis-service.


At one time, I got an assignment "Write a robust, user friendly SMTP
client". That was just after we learned how to user 'for' loops and
'if' statements. Talk about dis-services ;-)

Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
Jan 28 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1540
by: Sam | last post by:
Hello, I am playing with the nntplib module and would like to know a public server that I can connect to to get articles from comp.lang.python. If you could give me the address of a public server that would be great. Thanks, Sam.
2
7931
by: Mark Carter | last post by:
I'm trying to create a mail server in Twisted. I either get SMTPSenderRefused or SMTPException: SMTP AUTH extension not supported by server. What do I need to do to get it to work?
0
2524
by: Phillip J. Eby | last post by:
PEP: 333 Title: Python Web Server Gateway Interface v1.0 Version: $Revision: 1.1 $ Last-Modified: $Date: 2004/08/27 17:30:09 $ Author: Phillip J. Eby <pje at telecommunity.com> Discussions-To: Python Web-SIG <web-sig at python.org> Status: Draft Type: Informational Content-Type: text/x-rst Created: 07-Dec-2003
1
1372
by: HellCat | last post by:
Can anyone here point me to a mail server with a Python backend? The Java Apache Mail Enterprise server is for Java, is there a comparable mail server for Python? I could install JAMES but I prefer to use Python rather than Java. I am going to use it in a small (less than 500 users) enterprise setting so my requirements are not that...
6
2557
by: Gary Kshepitzki | last post by:
Hello I am trying to send an event from a Python COM server to a VB (or VB.NET) COM client. I am a newbie both in VB and in python. Can anyone give me a simple (but complete) code example both of the Python server side and the VB client side for raising a single event. Any answer would be highly appreciated. Regards Gary
0
1274
by: Vinayakc | last post by:
I am new for python. I have written one code which generates RFC2822 file. I have header in string format. i am using following code. emailData = emailData.encode("utf-8") hdr = email.message_from_string(emailData) tmpContentType = msg del msg
4
1683
by: sujatasingh_orlando | last post by:
Hello, I have to implement a mail server type program for a project using python. I have already implemented smtp and pop3 protocol to send and retrieve mail at the client side. I used an existing mail server account to test the code. Now, I need to write the functionality of the mail server end. My goal is to receive emails from a few...
9
2443
by: eric | last post by:
Hi all, I want to setup simple python web server and I want it to just unzip and run, without any installation steps (have no right to do it). I've tried to write by myself, however, I find I am getting into more details like processing image file, different file type(like FLV) .. etc. Any recommendation or tools suggested for me? ...
4
1746
by: =?Utf-8?B?UmljaA==?= | last post by:
I want to build an simple email smtp client app similar to outlook except with some custom features for a personal computer that uses comcast cable. The owner of the computer said she doesn't have a comcast email and uses gmail instead, but the internet service provider is comcast. This computer also does not have MS Office loaded - otherwise...
0
7781
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7699
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8027
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
5594
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3733
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3733
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2216
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1304
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1041
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.