Overview
Features
Download
Documentation
Community
Add-Ons & Services

Poco::Net::StreamSocket question

A general discussion forum.

Poco::Net::StreamSocket question

Postby euphreme » 27 Nov 2008, 22:31

We have a c++ server running with Poco libraries, when the constructor gets called, we add an event handler to a SocketReactor so we can read incoming requests from outsiders client.

The client I am coding is written in java.

When attempting a connection, everything goes well until we close the connection.

My server then receives something and then, the handler gets called indefinitely, when attempting to access the socket, Poco throws an exception "Connection reset by peer".

My question: How is this a problem ? The client closed the connection because he had his response, why is the server handler keeps getting called indefinitely, should a flag be set ?

Thanks for your replies.
- Pascal
euphreme
 
Posts: 7
Joined: 26 Nov 2008, 21:53

Re: Poco::Net::StreamSocket question

Postby alex » 28 Nov 2008, 21:48

> My question: How is this a problem ? The client closed the connection because he had his response, why is the server handler keeps getting called indefinitely, should a flag be set ?

Based on the information you have provided, it is impossible to answer any of the questions. If you put forth an effort to assemble a minimal code example reproducing the problem, then someone may be able to help you. The keywords are 'minimal' and 'reproducing'. Pages of copy-pasted code tend to discourage people from getting involved. In the process of doing that, you may even learn where the problem is in your code. Or you may demonstrate a legitimate problem in the framework to us.
alex
 
Posts: 1143
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Poco::Net::StreamSocket question

Postby WITTROCK » 29 Nov 2008, 04:37

When you say the "handler" get called indefinitely, are you talking about the ReadableNotification? If so, then I think this is expected behavior. If your event handler for the ReadableNotification gets fired, and the receiveBytes() member function of the socket returns 0 bytes, then it means the socket was closed. In this case the handler should free itself. That is my understanding anyway.

You might take a look at the EchoServer example, as it demonstrates the use of the SocketReactor, and this is how it handles the ReadableNotification.

-WITTROCK
WITTROCK
 
Posts: 10
Joined: 06 Dec 2007, 22:29
Location: United_States


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron