Login  
Search All Forums
Dart Home | PowerTCP SSL for ActiveX | Custom Development Reply | PowerTCP SSL for ActiveX Topics | Forums   
AuthorForum: PowerTCP SSL for ActiveX
Topic: SecureTCP Accept()
mjxnjx

From: sunnyvale, CA USA
Posts: 26
Member Since: 06/15/05
posted October 5, 2006 7:18 PM

I believe I need to access the Accept() function of the SecureTCP control for the SSL Tool. It looks like I have access to Listen() and Receive(), but not Accept(). I believe I need access to Accept() so I can call Receive() manually in a loop until the State changes to tcpclosed so I can be sure I have received all the data for the request. Is this the case or is there another way to go about this?
mjxnjx

From: sunnyvale, CA USA
Posts: 26
Member Since: 06/15/05
posted October 6, 2006 12:16 PM

Any help would be appreciated. I've gone through the documentation provided by Dart and through these forums for several hours.

It appears there is currrently no method of receiving the entire request using the SSL Tool since there is no method of overriding the Accept() function to loop through multiple Receive()s. The WebServer tool seems to provide this, but we do not need this full tool as there is already a signficant amount of customization in our code in handling requests. If simply the Accept() function was exposed (or a new function were added that emulates the Receive() loop - say 'ReceiveFullRequest()'), this tool would do exactly what we need it to.


Raj

From: Rome, NY, USA
Posts: 389
Member Since: 02/01/06
posted October 6, 2006 2:29 PM

I am not sure if you are referring to SecureServer Control or the SecureTcp Control because Listen method and Receive event is available in SecureServer; whereas SecureTcp only gives Receive Method/Event.

The SecureServer Control is for listening, and creating servers. And the SecureTcp is for creating clients that connect to servers.

Thanks,
-Raj
mjxnjx

From: sunnyvale, CA USA
Posts: 26
Member Since: 06/15/05
posted October 6, 2006 6:06 PM

Sorry, you are correct. It is the SecureServer control. I have the Listen() and Receive() methods but no way to work with the Accept() method so I can get the whole request.
Raj

From: Rome, NY, USA
Posts: 389
Member Since: 02/01/06
posted October 9, 2006 9:21 AM

Okay, so you are looking for an accept method. Actually there is no need for any accept method, because the control automatically accepts new connections.
Earlier you said: "I believe I need access to Accept() so I can call Receive() manually in a loop until the State changes to tcpclosed"

The server is always in a listening state (after you have called listen method), so it is ready to receive as and when data comes in.
You only need to use the receive event to capture the incoming data, and the connection will close only when the client or the server explicitly disconnects. Please refer the echo server and chat server samples.

Thanks,
Raj
mjxnjx

From: sunnyvale, CA USA
Posts: 26
Member Since: 06/15/05
posted October 9, 2006 9:22 PM

Try this on the echo server example:

1) Add some code so that you can log each time the Receive() function is called.
2) Start the Echo Server.
3) Send 30000 bytes of data to it in a single request (such as a large POST request).
4) Check the Log to see how many times Receive() was called.

Here's what you'll end up with: Receive() gets called several times. The reason is explained in your own documentation (SSL Tool / Quick Start / Using the SecureTCP Control / Basic Sending and Receiving):

Receiving all data

If you have to receive a substantial amount of data, often it requires multiple Receive operations to get it all.


Your example shows how to handle this if you are DOWNLOADING a web page, but not how to handle it if you are LISTENING and ACCEPTING a request. I believe the solution is to simply keep calling Receive() until "tcpClosed" is returned out of an override of the Accept() function, but if there's another way to get ALL the data from a single request and know when the request is complete i'd love to know what it is.

I see two solutions as it stands:

1) Allow for an override of the Accept() function.

or

2) Provide a new function ReceiveFullRequest() that does this automatically.
Raj

From: Rome, NY, USA
Posts: 389
Member Since: 02/01/06
posted October 10, 2006 10:23 AM

Sorry about the last post, that was not a good way of doing this and might lead to other altercations later on.

To implement what you need, your server needs to track the status of the clients, and receive data until their state changes to closed. The state of child connections can be tracked using the State event of the Server Tool. It will not be a good idea to recursively call receives method from another Dart event, as that might lead to unexpected results, because our events are non reentrant.

This will be too complicated to be handled on the forum, please contact support@dart.com to discuss other support options.

Regards,
Raj
mjxnjx

From: sunnyvale, CA USA
Posts: 26
Member Since: 06/15/05
posted October 10, 2006 12:42 PM

I had the same thought, but unfortunately the Child->State() doesn't change from within the Receive() function (so it's never tcpClosed anywhere I can get to it). I'm guessing the setting to make the state tcpClosed happens somewhere in the Accept() function, which is what I probably need to get into.

You're right. It's kind of a simple thing - just trying to get the full request sent from a client - but it's complicated to discuss and debug.

I will discuss further through email. Thanks for your help, Raj.
Reply | PowerTCP SSL for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX