Re: [twsocket] SocketSpy to C++ Problem

2011-01-28 Thread Richard Christman
Hi Arno,

I went back over everything you provided for me and I finally got it! I have
it working now.

Thanks so much,

Richard

--
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


Re: [twsocket] SocketSpy to C++ Problem

2011-01-23 Thread Richard Christman
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


Re: [twsocket] SocketSpy to C++ Problem

2011-01-23 Thread Arno Garrels
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. 

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. 

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: 

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


Re: [twsocket] SocketSpy to C++ Problem

2011-01-22 Thread Richard Christman
Hi Arno,

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.

> -Original Message-
> From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org]
> On Behalf Of Arno Garrels
> Sent: Saturday, January 22, 2011 12:29 PM
> To: ICS support mailing
> Subject: Re: [twsocket] SocketSpy to C++ Problem
> 
> Richard Christman wrote:
> > Hi Arno,
> >
> > I took out the banner and still the error. I took out banner and
> > bannertoobusy (individually and both together) and neither made
> > difference.
> >
> > I also commented out all logging last week and no difference from
> that
> > either.
> 
> I tested with 2010 with some additional changes specific to Unicode,
> will try tomorrow with 2007 and let you know my results.
> 
> --
> 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


Re: [twsocket] SocketSpy to C++ Problem

2011-01-22 Thread Richard Christman


> -Original Message-
> From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org]
> On Behalf Of Arno Garrels
> Sent: Saturday, January 22, 2011 12:29 PM
> To: ICS support mailing
> Subject: Re: [twsocket] SocketSpy to C++ Problem
> 
> Richard Christman wrote:
> > Hi Arno,
> >
> > I took out the banner and still the error. I took out banner and
> > bannertoobusy (individually and both together) and neither made
> > difference.
> >
> > I also commented out all logging last week and no difference from
> that
> > either.
> 
> I tested with 2010 with some additional changes specific to Unicode,
> will try tomorrow with 2007 and let you know my results.
> 

Thanks so much, Arno.

--
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


Re: [twsocket] SocketSpy to C++ Problem

2011-01-22 Thread Arno Garrels
Richard Christman wrote:
> Hi Arno,
> 
> I took out the banner and still the error. I took out banner and
> bannertoobusy (individually and both together) and neither made
> difference. 
> 
> I also commented out all logging last week and no difference from that
> either.

I tested with 2010 with some additional changes specific to Unicode, 
will try tomorrow with 2007 and let you know my results.

-- 
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


Re: [twsocket] SocketSpy to C++ Problem

2011-01-22 Thread Richard Christman
Hi Arno,

I took out the banner and still the error. I took out banner and
bannertoobusy (individually and both together) and neither made difference.

I also commented out all logging last week and no difference from that
either.

> -Original Message-
> From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org]
> On Behalf Of Arno Garrels
> Sent: Saturday, January 22, 2011 4:11 AM
> To: ICS support mailing
> Subject: Re: [twsocket] SocketSpy to C++ Problem
> 
> Richard,
> 
> Do not send a server banner:
> 
> void __fastcall TSocketWin::ListenBtnClick(TObject *Sender)
> {
>if (ListenBtn->Tag == 0)
>{
>NNTPLog->Clear();
>   WSocketServer->Banner = ""; //<== !
> 
> 
> Make sure this one doesn't AV :
> void __fastcall TSocketWin::Log(AnsiString Msg)
> {
>while (Msg.Length() && (Msg[Msg.Length()] == '\n' ||
> Msg[Msg.Length()] == '\r'))
>Msg.Delete(Msg.Length(), 1);
>log->Add(Msg);
> }
> 
> --
> 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


Re: [twsocket] SocketSpy to C++ Problem

2011-01-22 Thread Richard Christman
Sorry for the confusion, my problem isn't solved... It was getting you the
project that was solved.

My problem with translating SocketSpy isn't fixed.

> -Original Message-
> From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org]
> On Behalf Of Wilfried Mestdagh
> Sent: Saturday, January 22, 2011 3:00 AM
> To: 'ICS support mailing'
> Subject: Re: [twsocket] SocketSpy to C++ Problem
> 
> Hi,
> 
> > Sorry again, Francois told me and I missed it.
> > https://www.quicksilvermail.net/socketspyc.zip
> 
> Glad it is solved :)
> 
> --
> mvg, Wilfried
> http://www.mestdagh.biz
> http://www.comfortsoftware.be
> http://www.expertsoftware.be
> 
> > -Oorspronkelijk bericht-
> > Van: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org]
> > Namens Richard Christman
> > Verzonden: zaterdag 22 januari 2011 9:45
> > Aan: twsocket@elists.org
> > Onderwerp: [twsocket] SocketSpy to C++ Problem
> >
> > Hi All,
> >
> > Sorry again, Francois told me and I missed it.
> >
> > https://www.quicksilvermail.net/socketspyc.zip
> >
> > I have done a cbuilder translation of Mr. Mestdagh's SpocketSpy
> > program.
> > But, I have a problem. When I run the program and try to connect with
> a
> > server, I get this immediate error:
> >
> > "An unknown response was received in response to a request for
> > information
> > from the news server 'SocketSpyC++ Local TCP Proxy'"
> >
> > Under the details button of the error dialog, I get:
> >
> > SocketSpyC++ Local TCP Proxy
> >
> > Configuration:
> >Account: SocketSpyC++ Local TCP Proxy
> >Server: 127.0.0.1
> >Protocol: NNTP
> >Port: 119
> >Secure(SSL): 0
> >Code: 800ccca0
> >
> > I don't have any idea what the problem is. First, while trying to
> > debug, I
> > put a popup messagebox at the end of the WSocketServerClientConnect
> > procedure to take a look at a variable. What I discovered was that
> > messagebox being open allowed the program to actually connect and go
> > further
> > before error. After that, I replaced the messagebox with an
> > Application->ProcessMessages() loop as a test. I was amazed that
> after
> > that,
> > the program ran completely and reliably--everytime. It works just
> > great, but
> > I haven't tried more than 1 connection because of the ProcessMessages
> > loop.
> > Though the loop has been helpful, I doubt it is the appropriate fix
> for
> > this.
> >
> > My socketspyc project is attached. Please have a look. The
> > ProcessMessages
> > loop is at the end of the WSocketServerClientConnect procedure.
> >
> > Regards,
> >
> > Richard Christman
> > https://www.quicksilvermail.net
> >
> > --
> > 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

--
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


Re: [twsocket] SocketSpy to C++ Problem

2011-01-22 Thread Arno Garrels
Richard,

Do not send a server banner:

void __fastcall TSocketWin::ListenBtnClick(TObject *Sender)
{
   if (ListenBtn->Tag == 0)
   {
   NNTPLog->Clear();
  WSocketServer->Banner = ""; //<== !


Make sure this one doesn't AV :
void __fastcall TSocketWin::Log(AnsiString Msg)
{
   while (Msg.Length() && (Msg[Msg.Length()] == '\n' || Msg[Msg.Length()] == 
'\r'))
   Msg.Delete(Msg.Length(), 1);
   log->Add(Msg);
}

-- 
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


Re: [twsocket] SocketSpy to C++ Problem

2011-01-22 Thread Wilfried Mestdagh
Hi,

> Sorry again, Francois told me and I missed it.
> https://www.quicksilvermail.net/socketspyc.zip

Glad it is solved :)

-- 
mvg, Wilfried
http://www.mestdagh.biz
http://www.comfortsoftware.be
http://www.expertsoftware.be

> -Oorspronkelijk bericht-
> Van: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org]
> Namens Richard Christman
> Verzonden: zaterdag 22 januari 2011 9:45
> Aan: twsocket@elists.org
> Onderwerp: [twsocket] SocketSpy to C++ Problem
> 
> Hi All,
> 
> Sorry again, Francois told me and I missed it.
> 
> https://www.quicksilvermail.net/socketspyc.zip
> 
> I have done a cbuilder translation of Mr. Mestdagh's SpocketSpy
> program.
> But, I have a problem. When I run the program and try to connect with a
> server, I get this immediate error:
> 
> "An unknown response was received in response to a request for
> information
> from the news server 'SocketSpyC++ Local TCP Proxy'"
> 
> Under the details button of the error dialog, I get:
> 
> SocketSpyC++ Local TCP Proxy
> 
> Configuration:
>Account: SocketSpyC++ Local TCP Proxy
>Server: 127.0.0.1
>Protocol: NNTP
>Port: 119
>Secure(SSL): 0
>Code: 800ccca0
> 
> I don't have any idea what the problem is. First, while trying to
> debug, I
> put a popup messagebox at the end of the WSocketServerClientConnect
> procedure to take a look at a variable. What I discovered was that
> messagebox being open allowed the program to actually connect and go
> further
> before error. After that, I replaced the messagebox with an
> Application->ProcessMessages() loop as a test. I was amazed that after
> that,
> the program ran completely and reliably--everytime. It works just
> great, but
> I haven't tried more than 1 connection because of the ProcessMessages
> loop.
> Though the loop has been helpful, I doubt it is the appropriate fix for
> this.
> 
> My socketspyc project is attached. Please have a look. The
> ProcessMessages
> loop is at the end of the WSocketServerClientConnect procedure.
> 
> Regards,
> 
> Richard Christman
> https://www.quicksilvermail.net
> 
> --
> 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


[twsocket] SocketSpy to C++ Problem

2011-01-22 Thread Richard Christman
Hi All,

Sorry again, Francois told me and I missed it.

https://www.quicksilvermail.net/socketspyc.zip

I have done a cbuilder translation of Mr. Mestdagh's SpocketSpy program.
But, I have a problem. When I run the program and try to connect with a
server, I get this immediate error:

"An unknown response was received in response to a request for information
from the news server 'SocketSpyC++ Local TCP Proxy'"

Under the details button of the error dialog, I get:

SocketSpyC++ Local TCP Proxy

Configuration:
   Account: SocketSpyC++ Local TCP Proxy
   Server: 127.0.0.1
   Protocol: NNTP
   Port: 119
   Secure(SSL): 0
   Code: 800ccca0

I don't have any idea what the problem is. First, while trying to debug, I
put a popup messagebox at the end of the WSocketServerClientConnect
procedure to take a look at a variable. What I discovered was that
messagebox being open allowed the program to actually connect and go further
before error. After that, I replaced the messagebox with an
Application->ProcessMessages() loop as a test. I was amazed that after that,
the program ran completely and reliably--everytime. It works just great, but
I haven't tried more than 1 connection because of the ProcessMessages loop. 
Though the loop has been helpful, I doubt it is the appropriate fix for
this.

My socketspyc project is attached. Please have a look. The ProcessMessages
loop is at the end of the WSocketServerClientConnect procedure.

Regards,

Richard Christman
https://www.quicksilvermail.net

--
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


[twsocket] SocketSpy to C++ Problem

2011-01-22 Thread Richard Christman
Hi All,

My apologies. When the list sent my message to me, there was no attachment.
I'm going to try again in case I screwed this up. If it arrives without it
please tell me how I'm to include my project. 



I have done a cbuilder translation of Mr. Mestdagh's SpocketSpy program.
But, I have a problem. When I run the program and try to connect with a
server, I get this immediate error:

"An unknown response was received in response to a request for information
from the news server 'SocketSpyC++ Local TCP Proxy'"

Under the details button of the error dialog, I get:

SocketSpyC++ Local TCP Proxy

Configuration:
   Account: SocketSpyC++ Local TCP Proxy
   Server: 127.0.0.1
   Protocol: NNTP
   Port: 119
   Secure(SSL): 0
   Code: 800ccca0

I don't have any idea what the problem is. First, while trying to debug, I
put a popup messagebox at the end of the WSocketServerClientConnect
procedure to take a look at a variable. What I discovered was that
messagebox being open allowed the program to actually connect and go further
before error. After that, I replaced the messagebox with an
Application->ProcessMessages() loop as a test. I was amazed that after that,
the program ran completely and reliably--everytime. It works just great, but
I haven't tried more than 1 connection because of the ProcessMessages loop. 
Though the loop has been helpful, I doubt it is the appropriate fix for
this.

My socketspyc project is attached. Please have a look. The ProcessMessages
loop is at the end of the WSocketServerClientConnect procedure.

Regards,

Richard Christman
https://www.quicksilvermail.net
--
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

[twsocket] SocketSpy to C++ Problem

2011-01-21 Thread richard
Hi All,

I have done a cbuilder translation of Mr. Mestdagh's SpocketSpy 
program. But, I have
a problem. When I run the program and try to connect with a server, I 
get this
immediate error:

"An unknown response was received in response to a request for 
information from the
news server 'SocketSpyC++ Local TCP Proxy'"

Under the details button of the error dialog, I get:

SocketSpyC++ Local TCP Proxy

Configuration:
   Account: SocketSpyC++ Local TCP Proxy
   Server: 127.0.0.1
   Protocol: NNTP
   Port: 119
   Secure(SSL): 0
   Code: 800ccca0

I don't have any idea what the problem is. First, while trying to 
debug, I put a
popup messagebox at the end of the WSocketServerClientConnect 
procedure to take a
look at a variable. What I discovered was that messagebox being open 
allowed the
program to actually connect and go further before error. After that, 
I replaced the
messagebox with an Application->ProcessMessages() loop as a test. I 
was amazed that
after that, the program ran completely and reliably--everytime. It 
works just great,
but I haven't tried more than 1 connection because of the 
ProcessMessages loop.
Though the loop has been helpful, I doubt it is the appropriate fix 
for this.

I'm wondering if this problem is somehow related to changes made to 
cbuilder in the
2007 edition I'm using. I have already discovered and fixed 2 other 
problems related
to the 2007 upgrade. I'm using Vista64.

My socketspyc project is attached. Please have a look. The 
ProcessMessages loop is at the end of the WSocketServerClientConnect 
procedure.

Regards,

Richard Christman
https://www.quicksilvermail.net
--
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