Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Creating a listener

Posted on 2009-07-07
7
Medium Priority
?
334 Views
Last Modified: 2012-05-07
Hi,

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!
0
Comment
Question by:StraySod
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 12

Expert Comment

by:Let_Me_Be
ID: 24795646
What kind of listener?
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24796297
Do you mean a listener for clients in socket programming?
0
 
LVL 40

Accepted Solution

by:
mrjoltcola earned 1000 total points
ID: 24796369
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
http://www.nsoftware.com

Also Chilkat
http://www.chilkatsoft.com/

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: http://en.wikipedia.org/wiki/Berkeley_sockets

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:

socket()
bind()
listen()
while(true) {
   accept()   // new connection
   service connection
   close()
}


0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 40

Assisted Solution

by:evilrix
evilrix earned 1000 total points
ID: 24796724
Are you trying to implement an observer pattern?
http://en.wikipedia.org/wiki/Observer_pattern

If so try this tutorial: "Implementing the Observer Pattern in C++ - Part 1"
http://accu.org/index.php/journals/372
0
 
LVL 7

Author Closing Comment

by:StraySod
ID: 31600608
Thank you. Your comment was helpful
0
 
LVL 40

Expert Comment

by:evilrix
ID: 24797236
I'm slightly confused as the two selected answer are, mostly, unrelated.
0
 
LVL 7

Author Comment

by:StraySod
ID: 24805174
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
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question