Creating a listener


in my application I need to write a custom listener. Could you please help me to start? I've never wrote something like that. Are there any classes in C++ which I could reuse, do you know some other relevant resources? Thank you in advance!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

What kind of listener?
Do you mean a listener for clients in socket programming?
In standard C++ there are no "standard" listener classes. You will be using sockets either way. You can get an API that has implemented TCP client / server classes.

IP*Works makes it easy

Also Chilkat

Since you did not specificy a platform, I cannot tell much more except on Windows you will be using winsock capability in your project.
On UNIX you use "Berkeley sockets" API.

Start here:

Also look online for UNIX Network Programming by W. RIchard Stevens, it is the classic standby and still the best. Even if not using UNIX, it covers the sockets API in extreme detail and most samples will compile on Windows.

Essentially, for a server, you do the following:

while(true) {
   accept()   // new connection
   service connection


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.

evilrixSenior Software Engineer (Avast)Commented:
Are you trying to implement an observer pattern?

If so try this tutorial: "Implementing the Observer Pattern in C++ - Part 1"
StraySodAuthor Commented:
Thank you. Your comment was helpful
evilrixSenior Software Engineer (Avast)Commented:
I'm slightly confused as the two selected answer are, mostly, unrelated.
StraySodAuthor Commented:
It's because I'm only doing a research, not implementing yet and both answers helped me to understand some concepts. I'm sure it's fair to split points the way I did it in this case :) Thank you again
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.