Sunday, February 14, 2016

Digest for comp.lang.c++@googlegroups.com - 25 updates in 4 topics

alexo <alelvb@inwind.it>: Feb 14 06:01PM +0100

Hello group,
 
I've written for UNIX a little program [FLTK] that needs to send an
order through e-mail.
 
I'm absolutely new to socket programming so you are my first attempt.
In a couple of tutorials I've built a pair of toy client/server programs
that showed me how to use sockets. It seems not so hard to program them,
but I need some help and infos.
 
My program is intended to be a stand alone program with a send button.
When the user hits the send button I'd like it (the program) sends an
email to my email address with the order message in it.
 
I know that SMTP port is 25, but I don't know how to configure the
aspects required.
 
Could you please guide me through that, or could you link me to a clear
intro of the subject?
 
My program, as already said, is written for Linux, but I'll later
convert it to Windows where it is intended to run.
Conversion of the GUI part is not necessary since FLTK is a
cross-platform graphic library, but socket programming is dependent on
architecture. The functions to invoke are of course different, and I'll
appreciate it so much if you could explain how to send email from a
C/C++ program using TCP/IP o SMTP for both linux and windows.
 
thank you
 
alexo
JiiPee <no@notvalid.com>: Feb 14 05:07PM

I did that in my email project back in 2000 in a software company I was
working. I used a ready made class for doing that. Why not use a
classes/libraries to do it, why invent the weel again? Or is this more
like a learning process? That class I used worked very nicely and might
be even better now.
 
On 14/02/2016 17:01, alexo wrote:
JiiPee <no@notvalid.com>: Feb 14 05:12PM

If I remember correctly, it was actually this one:
http://www.codesink.org/mimetic_mime_library.html#intro
 
anyway, that looks something I was using
 
On 14/02/2016 17:07, JiiPee wrote:
Paavo Helde <myfirstname@osa.pri.ee>: Feb 14 07:18PM +0200

On 14.02.2016 19:01, alexo wrote:
> In a couple of tutorials I've built a pair of toy client/server programs
> that showed me how to use sockets. It seems not so hard to program them,
> but I need some help and infos.
 
In C++, when working with sockets I would strongly recommend using a
cross-platform library or framework for that, otherwise you will never
get the hairy platform-specific tricks correct.
 
Boost asio is an example of such a good library, probably there are
others. ASIO mean async i/O, it might be you don't need its asynchronous
capabilities in the beginning, so you can ignore them, the rest of the
library still does much work for you. Just look up the examples and
build on top of them.
"Öö Tiib" <ootiib@hot.ee>: Feb 14 09:39AM -0800

On Sunday, 14 February 2016 19:01:29 UTC+2, alexo wrote:
> aspects required.
 
> Could you please guide me through that, or could you link me to a clear
> intro of the subject?
 
Why you use e-mail? There can be SSL/TLS connection made between SMTP,
IMAP or POP3 server and client but lot of servers do not do even that,
instead ask for authentication as open text. There also are no guarantee
any further, so e-mail can travel between servers as open text anyway.
So it is basically only worthless spam that can be sent by e-mail.
alexo <alelvb@inwind.it>: Feb 14 07:44PM +0100

Il 14/02/2016 18:07, JiiPee ha scritto:
> Why not use a classes/libraries to do it, why invent the weel again? Or is this more
> like a learning process? That class I used worked very nicely and might
> be even better now.
 
I didn't know there were these opportunities.
I Think I'll study a bit how socket programming works behind the scenes.
Thank you
woodbrian77@gmail.com: Feb 14 10:47AM -0800

On Sunday, February 14, 2016 at 11:01:29 AM UTC-6, alexo wrote:
> C/C++ program using TCP/IP o SMTP for both linux and windows.
 
> thank you
 
> alexo
 
I've written some software that supports sending messages
over sockets on Linux, Windows and other operating systems.
There's a library available here:
 
http://webEbenezer.net/build_integration.html
 
Feel free to use the library in your project.
 
I also have an on line code generator called the C++
Middleware Writer (CMW) that might be helpful. I'm
willing to donate 16 hours/week for six months to a
project that uses the CMW.
 
Also we'll pay $1,400 and give a $1,200 investment in the
company to someone who helps us find someone interested
in this offer. We'll pay the $1,400 after working for four
months on the project. Ebenezer Enterprises works to reward
investments to 3 times the original amount. So the
investment would result in between $0 and $3,600, depending
on how things go for the company.
 
Brian
Ebenezer Enterprises - In G-d we trust.
http://webEbenezer.net
Paavo Helde <myfirstname@osa.pri.ee>: Feb 14 09:19PM +0200

On 14.02.2016 19:01, alexo wrote:
 
> My program is intended to be a stand alone program with a send button.
> When the user hits the send button I'd like it (the program) sends an
> email to my email address with the order message in it.
 
On a second thought, why do you need sockets at all? If you just want
the program to send you an order by e-mail, you could just open an URL like
 
mailto:yourname@example.com?subject=Order&body=Order%20details%20here
 
In Windows, this should be passed to the ShellExecute SDK function. In
Linux I guess there is no 100% sure way, but xdg-email ought to work in
most environments.
 
This would also give the user an opportunity to review the order and add
additional comments.
alexo <alelvb@inwind.it>: Feb 14 08:23PM +0100

Il 14/02/2016 18:39, Öö Tiib ha scritto:
 
> Why you use e-mail?
 
This was the first and simplest idea I got. Otherwise I had to implement
a server and it is up to now out of my reach.
 
> IMAP or POP3 server and client but lot of servers do not do even that,
> instead ask for authentication as open text. There also are no guarantee
> any further, so e-mail can travel between servers as open text anyway.
 
SSL/TLS is another thing should I have to learn? No thank you,
I'm not other than a hobbist.
That's too much for what I'm trying to do.
 
Thank you anyway.
alexo <alelvb@inwind.it>: Feb 14 08:29PM +0100

Il 14/02/2016 20:19, Paavo Helde ha scritto:
 
> On a second thought, why do you need sockets at all? If you just want
> the program to send you an order by e-mail, you could just open an URL like
 
> mailto:yourname@example.com?subject=Order&body=Order%20details%20here
 
The software I intend to use formats the info of the order sent in a way
easy to intellect.
My clients are too lazy to compile a form from their own with all the
infos formatted in a readable way.
Ian Collins <ian-news@hotmail.com>: Feb 15 08:40AM +1300

alexo wrote:
> aspects required.
 
> Could you please guide me through that, or could you link me to a clear
> intro of the subject?
 
Your issue isn't socket programming, it is how to use SMTP! You need a
configured SMTP server to interact with and you need to know how to do this.
 
> architecture. The functions to invoke are of course different, and I'll
> appreciate it so much if you could explain how to send email from a
> C/C++ program using TCP/IP o SMTP for both linux and windows.
 
Using winsock on Windows is almost identical to using sockets on a POSIX
system.
 
--
Ian Collins
"Chris M. Thomasson" <nospam@nospam.nospam>: Feb 14 12:09PM -0800

> "Ian Collins" wrote in message news:dic3gqFqc0vU5@mid.individual.net...
 
[...]
 
> Using winsock on Windows is almost identical to using sockets on a POSIX
> system.
 
FWIW, on Windows wrt winsock I use IOCP via "batched" dequeuing:
 
https://msdn.microsoft.com/en-us/library/windows/desktop/aa364988(v=vs.85).aspx
 
Is there a direct Linux alternative?
 
I guess Kernel async io:
 
http://lse.sourceforge.net/io/aio.html
 
or (epoll):
 
http://davmac.org/davpage/linux/async-io.html#epoll
 
?
Paavo Helde <myfirstname@osa.pri.ee>: Feb 14 10:29PM +0200

On 14.02.2016 21:29, alexo wrote:
> easy to intellect.
> My clients are too lazy to compile a form from their own with all the
> infos formatted in a readable way.
 
I guess you overlooked the body field in the URL.
Jerry Stuckle <jstucklex@attglobal.net>: Feb 14 04:04PM -0500

On 2/14/2016 12:01 PM, alexo wrote:
> C/C++ program using TCP/IP o SMTP for both linux and windows.
 
> thank you
 
> alexo
 
Just beware that nowadays many ISP's are blocking outbound connections
to port 25 to prevent spam (often due to viruses and/or trojan horses.
This is especially true for residential connections.
 
--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================
jt@toerring.de (Jens Thoms Toerring): Feb 14 09:20PM

> aspects required.
 
> Could you please guide me through that, or could you link me to a clear
> intro of the subject?
 
This rather likely won't work, even if you get everything right.
There are the following issues:
 
a) You need to figure out the mail server for the address
you want to send the email to. Many machines don't accept
connections on port 25 (or there's a firewall that prevents
accessing the port from the outside). You need to know the
mail server for the recipients domain. To get that you must
do an DNS query for the MX server of the destination domain.
b) Once you got the socket opened to that mail server you
need to understand the SMTP protocol to talk correctly
to the server and transfer the message.
c) While a and b can be done (though it requires quite a bit
of reading the corresponding RFCs) the killer is that most
mail servers nowadays don't accept mail from random machines
but only from the dedicated mail servers from the domain the
email is coming from. So unless the machine sending the mail
is marked in DNS as a mail server for the domain (i.e., has
an MX record) the mail won't get accepted.
d) And, if you want to talk to your own mail server to get it
to pass on the email on, many don't accept emails anymore
without encryption, so you also beed to know how to deal with
SSL/TLS.
 
On a UNIX system you'd better install and properly configure a
MTA (mail transport agent) that passes on the email to the
mail server for the senders domain that then forwards it to
the correct mail server on the receiving end. This typically
is done by spawning the 'sendmail' program (but which often
is a symbolic link to the actual MTA installed on the machine)
and let it deal with the details of handling the mail.
 
The nice old times when you could send out an email to your boss,
looking to the uninitiated as coming from 'god@heaven', are, thanks
to spam, over since a number of years.
 
If there's no usable MTA on the machine you intend to send mails
from you're screwed. And, sorry, no idea how to do it under
Windows...
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
woodbrian77@gmail.com: Feb 14 07:09AM -0800


> > Would others like to join me in making suggestions on how
> > to change that page? As Geoff mentioned, the order could
> > be alphabetical. That would be okay with me.
 
Are there some who would like to see the Java description
reduced a lot? If some insist on leaving the long Java
description, I think it should be moved to after the C++
description.
 
Brian
Ebenezer Enterprises - In G-d we trust.
http://webEbenezer.net
Daniel <danielaparker@gmail.com>: Feb 14 08:26AM -0800

> reduced a lot? If some insist on leaving the long Java
> description, I think it should be moved to after the C++
> description.
 
Hi Brian,
 
I see you've added to the C++ section: "C++ Middleware Writer automates the creation of serialization functions." I think that puts you in the category of people that Wikipedia describes as "Clearly not being here to build an encyclopedia" by virtue of "Narrow self-interest and/or promotion of themselves or their business".
 
So: you should either provide a reference to a book or article from a third party source that discusses the Middleware Writer in the context of C++ serialization, or delete that text.
 
Daniel
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Feb 14 04:37PM

On 14/02/2016 16:26, Daniel wrote:
 
> Hi Brian,
 
> I see you've added to the C++ section: "C++ Middleware Writer automates the creation of serialization functions." I think that puts you in the category of people that Wikipedia describes as "Clearly not being here to build an encyclopedia" by virtue of "Narrow self-interest and/or promotion of themselves or their business".
 
> So: you should either provide a reference to a book or article from a third party source that discusses the Middleware Writer in the context of C++ serialization, or delete that text.
 
I have removed the advertisement from that Wikipedia article. Brian:
you cannot re-add it as doing so is a conflict of interest.
 
/Flibble
"Öö Tiib" <ootiib@hot.ee>: Feb 14 09:12AM -0800

On Sunday, 14 February 2016 18:37:56 UTC+2, Mr Flibble wrote:
 
> > So: you should either provide a reference to a book or article from a third party source that discusses the Middleware Writer in the context of C++ serialization, or delete that text.
 
> I have removed the advertisement from that Wikipedia article. Brian:
> you cannot re-add it as doing so is a conflict of interest.
 
Good. However he was correct that the Java is oddly large brick of nausea
there.
 
One issue is that lot of Java is about technical details how it works
and what developer can do:
|> Primitives as well as non-transient, non-static referenced objects
|> are encoded into the stream. Each object that is referenced by the
|> serialized object and not marked as transient must also be serialized;
|> and if any object in the complete graph of non-transient object
|> references is not serializable, then serialization will fail. The
|> developer can influence this behavior by marking objects as transient,
|> or by redefining the serialization for an object so that some portion
|> of the reference graph is truncated and not serialized.
 
Who cares? That sounds rather uninteresting, read the manual if it
concerns you.
 
Other portion of Java is explaining something that is not somehow
related to Java. It basically tells that:
 
Q: Why some objects in a program *written* *in* *whatever* *language*
do not make sense to serialize without special additional effort by
programmer taken?
A: Three main reasons:
1) Not all runtime objects capture useful information for
serialized state. There are lot of such objects like resource handles,
file descriptors, threads, sockets and synchronization primitives of
underlying platform that can not be used if deserialized.
2) Software evolves over time and so does the data but different
version of same software are often in use side-by-side. Achieving
compatibility between versions requires additional efforts.
3) Lot of runtime objects contain sensitive or confidential data and
serializing such data needs special security precautions taken by
programmer if it is needed.
Gareth Owen <gwowen@gmail.com>: Feb 14 05:18PM


> I have removed the advertisement from that Wikipedia article. Brian:
> you cannot re-add it as doing so is a conflict of interest.
 
I did that once too. He put it back the next day.
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Feb 14 05:27PM

On 14/02/2016 17:18, Gareth Owen wrote:
 
>> I have removed the advertisement from that Wikipedia article. Brian:
>> you cannot re-add it as doing so is a conflict of interest.
 
> I did that once too. He put it back the next day.
 
Yeah, I noticed. :) Houston, we have a problem.
 
/Flibble
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Feb 14 09:14PM +0100


> So far G-d has helped us.
> http://webEbenezer.net
 
Well you (apparently, and I can't think who else) have also put a
reference to your software in Wikipedia.
 
That's a sin, and I'm editing it to remove that reference, as already
two others here have done.
 
References to your work will appear in Wikipedia if or when it's
deserved: it's not your job to put them there, and you're very wrong to
do so.
 
 
Cheers & hth.,
 
- Alf
woodbrian77@gmail.com: Feb 14 01:18PM -0800

Privacy and private property are under attack here.
Those who attack a man's efforts to make an honest
living with his hands have problems.
 
Brian
Ebenezer Enterprises - "At my first defense no one supported
me, but all deserted me; may it not be counted against them.
But the L-rd stood with me and strengthened me, so that
through me the proclamation might be fully accomplished, and
that all the Gentiles might hear; and I was rescued out of
the lion's mouth. The L-rd will rescue me from every evil
deed, and will bring me safely to His heavenly kingdom; to
Him be the glory forever and ever." 2nd Timothy 4
 
http://webEbenezer.net
Prroffessorr Fir Kenobi <profesor.fir@gmail.com>: Feb 14 12:01PM -0800

maybe this is not much good question (small
one) but a i had nothing much better i may
state it
 
personally when working i noticed i work in
those three 'phases'
 
most creative is invent phase when i code new
things, that i was not doing yet before
 
then i usually (always) need rest [unfortunatelly im not the one who could
code constantly, often must rest quite
heavily tu run further ]
 
then i also often feel need to rebuild the
things i was invented (coded/tried) before,
Fun thing is maybe as the codebase (set of
already invented things) is larger then
the rebuild 'phase' may grow bigger (as i need
to maintain/manage the bigger set - this is
though somewhat aproximate vision im not sure
if its true)
 
I also need read/study a lot, but this point i
may include in rest phase..
 
The question is: can you answer how much/how
big amount of your work time are consuming by
those three phases, I mean like in percent of
time (like a days or weeks in a year)?
 
How much % is resting/studying, How much % is
rebuilding, how much % is creative
inventing/implementing ?
woodbrian77@gmail.com: Feb 14 08:46AM -0800

The Association for Orthodox Jewish Scientists is
meeting this weekend.
 
http://www.aojs.org/
 
They have existed for over 60 years. I wonder if
there are any computer scientists in the group. :)
 
Brian
Ebenezer Enterprises - So far G-d has helped us.
http://webEbenezer.net
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: