Overview
Features
Download
Documentation
Community
Add-Ons & Services

Poco::Net::HttpServer dealocation problem

Please post support and help requests here.

Poco::Net::HttpServer dealocation problem

Postby Hellbard » 24 May 2007, 09:32

Hi in my aplication I need both the server and client. For client it was better to use libcurl, but for server the Poco was great. But when I am trying do dealocate the server objet, it throws me some mistake in dbgdel.cpp in Microsoft platform SDK for Windows server 2003
I cannot debug this file, so I want ask if anybody have to resolved the same problem.

this is part of my code:

init (){
Poco:Thread *thread = enew Poco:Thread();
Poco:Net::SocketAddress sadr(hostAndPort);
Poco:Net::ServerSocket svs(sadr);
Poco:Net::HTTPServer *newsrv = new Poco:Net:HTTPServer(this, svs,
new Poco:Net:HTTPServerParams);
thread->start(*newsrv);
}



doSomething(){
}



destroy (){
newsrv->stop();
delete newsrv;
delete thread;
}



int main (){
init();
doSomething();
destroy();
return 0;
}

Is there something I do not see? Can anybody tell me if mistake is on my side or it is wrong behavior of Poco:Net:Server??

Thanks for any response or experiences.

Milan Krapek

Sorry that it looks so horible, but when I use some symbols as double : , it makes new line and so on, so the style is awful
Hellbard
 
Posts: 12
Joined: 16 Mar 2007, 11:21

Re: Poco::Net::HttpServer dealocation problem

Postby alex » 25 May 2007, 00:43

> Is there something I do not see? Can anybody tell me if mistake is on my side or it is wrong behavior of Poco:Net:Server??

Two things:

1) What is the pointer you're passing to HTTPServer constructor? Are you launching the server from a request factory? At any rate, with code you have provided here, whatever you are launching it from will be deleted in TCPServerDispatcher when the server is deleted, which means that by deleting the server you are committing a suicide of sorts ;-) You should have a HTTPRequestHandlerFactory somewhere else to provide to the server constructor.

2) It's always a good idea to call thread.join() before deleting the thread.

HTH

Alex
alex
 
Posts: 1117
Joined: 11 Jul 2006, 16:27
Location: United_States


Return to Support

Who is online

Users browsing this forum: No registered users and 3 guests

cron