Thread View: borland.public.cppbuilder.internet.socket
4 messages
4 total messages
Started by Christer Borgqvist
Mon, 16 Oct 2006 21:39
TIdHTTPServerf
Author: Christer Borgqvist
Date: Mon, 16 Oct 2006 21:39
Date: Mon, 16 Oct 2006 21:39
44 lines
2061 bytes
2061 bytes
Hello all,
I have a TIdHTTPServer and in the Connect event i do like this
dataptr = new TServDataObj(this);
dataptr->OnIoInfo = IoInfoEvent;
AThread->Data = dataptr;
in the IdHTTPServerCommandGet like this
TServDataObj *dataptr;
dataptr = (TServDataObj*)AThread->Data;
dataptr->xmlVal = RequestInfo->Params->Values["trans"];
if ( dataptr->xmlVal.Length() > 10 ) {
dataptr->Exequte();
ResponseInfo->ContentStream = new
TStringStream(dataptr->sResponse);
ResponseInfo->ContentStream->Write("OK", 2 );
}
and in the dataptr i do this
typedef void __fastcall (__closure *TIoInfoEvent)(System::TObject* Sender,
AnsiString &Msg, AnsiString &Seqno, AnsiString &sReturnInfo, AnsiString
&sTextid, int &seq);
__fastcall TServDataObj::TServDataObj(TObject* Sender)
{
}
void __fastcall TServDataObj::Exequte()
{
//call a function and fire the event OnIoInfo
}
if ( FOnIoInfo && SDiDspTxt.Length() ) {
OnIoInfo(this, SDiDspTxt, seqno, sReturnInfo, sTxtId, F_localseqno);
the problem is that in the Taskmanager i can se that the handles is
increase every time i fire the event, why?
Christer
Re: TIdHTTPServerf
Author: Remy Lebeau (TeamB)
Date: Tue, 17 Oct 2006 01:08
Date: Tue, 17 Oct 2006 01:08
34 lines
1976 bytes
1976 bytes
"Christer Borgqvist" <christer.borgqvist10@bredband.net> wrote in message
news:4533fc25@newsgroups.borland.com...
> Hello all,
>
> I have a TIdHTTPServer and in the Connect event i do like this
Make sure you free the TServObj object in the OnDisconnect event.
> in the IdHTTPServerCommandGet like this
Are you setting a response if the request data is less than 10 characters?
> ResponseInfo->ContentStream = new
> TStringStream(dataptr->sResponse);
You don't need to wrap the Response string into a TStringStream.
TIdHTTPResponseInfo has a ContentText property that you can use instead:
ResponseInfo->ContentText = dataptr->sResponse;
> ResponseInfo->ContentStream->Write("OK", 2 );
Why are you appending an OK to the end of the response data?
> the problem is that in the Taskmanager i can se that the
> handles is increase every time i fire the event, why?
I don't see you freeing anything. But then again, the code you showed is
incompletely to begin with. You didn't even show what your event handler is
actually doing.
Gambit
Re: TIdHTTPServerf
Author: Christer Borgqvist
Date: Tue, 17 Oct 2006 05:54
Date: Tue, 17 Oct 2006 05:54
18 lines
1596 bytes
1596 bytes
Remy Lebeau (TeamB) skrev:
> "Christer Borgqvist" <christer.borgqvist10@bredband.net> wrote in message
> news:4533fc25@newsgroups.borland.com...
I free the TServObj in the OnDisconnect.
Yes I sett a response if less thar 10 character.
I have remove the stream an use the ContentText instead.
My event is as follow
void __fastcall TaxSOChipPinPadImpl::IoInfoEvent(TObject *Sender,
AnsiString &sMsg, AnsiString &Seqno, AnsiString &sReturnInfo,
AnsiString &sTextid, int &seq)
{
//I take care of the sMag, Seqno, ReturnInfo, Textid and the seq
//and some is stored in local variables
and calling a function in the mainthread.
}
Re: TIdHTTPServerf
Author: Remy Lebeau (TeamB)
Date: Tue, 17 Oct 2006 08:23
Date: Tue, 17 Oct 2006 08:23
20 lines
1623 bytes
1623 bytes
"Christer Borgqvist" <christer.borgqvist10@bredband.net> wrote in message news:45347006$1@newsgroups.borland.com... > My event is as follow <snip> Can you please show the actual code? > I take care of the sMag, Seqno, ReturnInfo, Textid and the > seq and some is stored in local variables and calling a function > in the mainthread. That does not answer my earlier question at all. You say that the event handler is increasing handles every time it is triggered, but you have not yet shown what you are asking doing in the code to begin with. Noone can diagnose the problem for you without those kinds of details. Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads