Re: [twsocket] SocketSpy to C++ Problem
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] NNTP / SMTP / POP3 proxy/tunnel
Hi Francois, Thanks very much for your offer. I'd like very much to see your proxy/tunnel. Please email it to me. Regards, Richard -Original Message- From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On Behalf Of Francois PIETTE Sent: Monday, January 24, 2011 12:53 AM To: ICS support mailing Subject: Re: [twsocket] NNTP / SMTP / POP3 proxy/tunnel 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. I wrote a SMTP/POP3 proxy server with HTTP tunnelling. You could use similar code in your NNTP proxy. Initially I wanted to implement NNTP the same way but had no time to do it yet. The goal of my application (OverbyteGateway and OverbyteGatewayServer as I named the beast) is to allow someone to use standard SMTP/POP3 client such as Windows Mail Client within an organization where only HTTP is allowed with the help of a second program running on another computer. Any computer or server is OK. I even use a dynamic IP by the way of DynDNS service. Instead of starting from SocketSpy I started at a higher level. I mean, SocketSpy works at the TCP level, not knowing anything about what is transported while the code I wrote understand SMTP and POP3 commands. This makes things easier as soon as you must intercept some specific command. When I said understand SMTP and POP3 commands, I don't mean complete command implementation. Since my proxy is mainly a tunnel, one side of the tunnel (client side) listen for POP3/SMTP commands, roughly decode it, encapsulate it into a HTTP request, send the the server side which in turn send it to the actual external SMTP/POP3 server. The code was fairly easy to write. Actually I implemented only the commands used by Windows Mail Client which I use. Other client program could require other commands altough it is likely not. I have not yet had time to publish this code. It probably need some cleaning and some commenting. Anyway, if you or someone else want it, I can build a zip file and email it. No waranty and no commitment to support it altough I will do my best to answer questions in twsocket mailing list. The license is almost the same as TWSocket: you can use it freely for whatever legal you want but you cannot claim you wrote the code. You must include a notice in your software (source code, about box and documentation) that you used my code, with clear reference to me and my website. And by the way, you can buy consulting or custom developement from me if you want me to customize that code for you, or private email support if you don't want to talk in public about your project. Email me for prices. -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) 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
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
[twsocket] SocketSpy to C++ Problem
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
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
Re: [twsocket] SocketSpy to C++ Problem
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
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
-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
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