Hi Arno,

> -----Original Message-----
> From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org]
> On Behalf Of Arno Garrels
> Sent: Sunday, January 23, 2011 1:09 AM
> To: ICS support mailing
> Subject: Re: [twsocket] SocketSpy to C++ Problem
> 
> Richard,
> 
> > I was looking over my project and see that the processmessages loop I
> > said allows the program to complete successfully is enabled. To allow
> > the error this needs to be commented out. It's at the end of
> > WSocketServerClientConnect.
> 
> I removed these lines.
> However it works (basically) with the changes posted in my previous
> message with latest ICSv7 and C++ Builder 2007.

I'm not sure which changes you refer to. Do you mean not sending a banner?
I've looked at the archives in case I missed a message. It looks like I
didn't, but I'm not sure what you're referring to. I think I've somehow
missed something.
 
> Tested with NNTP and HTTP (8 local clients). But since you use
> LineMode there's a problem with binary data because DataAvailable
> might not trigger when LineEnd is not received. Use LineMode only
> if the protocol is 100% line-based.

My purpose for translating socketspy was to just get it working in C++. My
intentions are to create a component that does what socketspy does, but it
will be used strictly with NNTP. Sorry I didn't mention that. I know the
logging to a richedit dramatically slows the redirection. That's just for
testing.

I want to build a simple NNTP proxy. However, I only need to intercept the
POST command and then grab the message. I've done this and I've found it
easy to accomplish. Do you think this slight variation of socketspy is
actually useable, or do I need a more robust proxy? I was unable to find a
NNTP proxy in Delphi/Cbuilder anywhere. I do like the simplicity of
socketspy. I could build on it if I should need more in the future.
 
> There's also a bug with shutting down the local client.
> After a call to ShutDown(1) it is no longer allowed to send data,
> however there might be still data in component's send buffer, so
> in order to avoid a socket exception and to make sure the local
> client gets everything add a flag to your client class and handle
> event OnDataSent, something like:

Thanks so much for this info, I'll sure fix that immediately.

Richard

> void __fastcall TSocketWin::ClientDataSent(TObject *Sender, WORD
> ErrCode)
> {
>   [..]
>   if (client->closeflag)
>       client->Shutdown(1);
> }
> 
> and
> 
> void __fastcall TSocketWin::RemoteSessionClosed(TObject *Sender, WORD
> Error)
> {
>    [..]
>    if (client->AllSent)
>        client->Shutdown(1);
>    else
>        client->closeflag = true;
> }
> 
> --
> Arno Garrels
> --
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to