473,655 Members | 3,114 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 5734
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
1546
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
7935
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
2528
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
1378
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 strict. Thanks in advance.
6
2563
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
1279
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
1688
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 accounts, look at the to addresses and forward it to different mailboxes. And, different users should be...
9
2449
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? Thanks,
4
1751
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 I would open Outlook and see what mail server it is using. On my development machine at my...
0
8296
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8710
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7310
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2721
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
2
1928
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1598
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.