Login  
Search All Forums
Dart Home | PowerTCP WebServer for ActiveX | Custom Development Reply | PowerTCP WebServer for ActiveX Topics | Forums   
AuthorForum: PowerTCP WebServer for ActiveX
Topic: Scalability options for the WebServer Tool
mljames

From: Indianapolis, IN USA
Posts: 9
Member Since: 02/21/03
posted February 24, 2003 5:29 PM

I am trying to launch an additional thread to handle larger processing pages. I noticed in earlier posts on this forum that there were bugs in the past with the .Delay functionality. Have these been fixed? Given how long ago they were posted, I would assume so, but wanted to check before moving forward.

If it has been addressed, are there any common mistakes that I might be making that could be causing the "Access Violation" errors that I'm getting? I'm using VC++6. Within the Get Event handler, I create an object that contains pointers that are assigned to each of the three parameters (Session, Request, Response). I then set Response->Delay = TRUE. Finally, I call CreateThread() and pass a pointer to the object containing the original pointers. Once the thread launches, all of the pointers are properly intact, but cannot be accessed. Is there something obvious here that I'm not doing right?

Below is the code fragment of what I'm doing right now.
typedef struct _webprocessthread_param
{
DartWebServer::ISession *lpSession;
DartWebServer::IRequest *lpRequest;
DartWebServer::IResponse *lpResponse;

} WEBPROCESSTHREAD_PARAM, *LPWEBPROCESSTHREAD_PARAM;

DWORD WINAPI WebProcessWorkerThread( LPVOID pvContext )
{
LPWEBPROCESSTHREAD_PARAM pThreadParam = (LPWEBPROCESSTHREAD_PARAM)pvContext;

DartWebServer::ISession *lpSession = pThreadParam->lpSession;
DartWebServer::IRequest *lpRequest = pThreadParam->lpRequest;
DartWebServer::IResponse *lpResponse = pThreadParam->lpResponse;

CString csFile = (char*)lpRequest->FileName;
CString csQS = (char*)lpRequest->GetUrlQueryString();

// Create a stream to hold the text of the page
DartWebServer::IDartStreamPtr Body;
Body.CreateInstance(DartWebServer::CLSID_DartStream);
CString csLine;

csLine.Format( "<html><body><b>%s</b><br>%s</body></html>", csFile, csQS );

// Now create a variant to and assign the string to it
// This is done because the write method requires variant
// of type BSTR
COleVariant ovLine;
ovLine.ChangeType(VT_BSTR);
ovLine.bstrVal = _bstr_t(csLine);

// Add the text to the stream
Body->Write(ovLine,0);

// Set the status of the Response
lpResponse->Status = DartWebServer::httpOK;

// Add the stream to the Response
lpResponse->Body = Body;

lpResponse->Send();

return 1;
}

void CSMWebServerDlg::OnWebserver_Get(LPDISPATCH Session, LPDISPATCH Request, LPDISPATCH Response)
{
HANDLE hThread;
DWORD dwThreadId;
LPWEBPROCESSTHREAD_PARAM threadParam;

threadParam = new WEBPROCESSTHREAD_PARAM;

TRACE( "%x, %x, %x\n", Session, Request, Response );
threadParam->lpSession = (DartWebServer::ISession *)Session;
threadParam->lpRequest = (DartWebServer::IRequest *)Request;
threadParam->lpResponse = (DartWebServer::IResponse *)Response;

((DartWebServer::IResponse *)Response)->Delay = TRUE;

hThread = CreateThread( NULL, 0, WebProcessWorkerThread, (LPVOID)threadParam, 0, &dwThreadId );

}

I would appreciate any help/assistance that anyone could provide.

Thanks,
Matt James
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted February 25, 2003 10:13 AM

Hi Matt,
Delay has been fixed, and I have successfully used it in VB, passing the Session, Request and Response objects to ActiveX exes.

Not being an accomplished VC++ programmer, I lack experience in writing multi-threaded apps, and have not used Delay in VC. You may want to consider a higher level support package for help with this, as I am afraid it is not something I will be able to help with on the forum.
-ken
User501

From: PADOVA, Italy
Posts: 13
Member Since: 09/30/01
posted August 27, 2003 6:06 AM

Hi Ken,

we also need an example of VB Activex exe to do a multithread web server using your server tool.

If you have already made it can you send the sample ?

Many thanks in advance,

Gionatha
subhendu

From: Kolkata, India
Posts: 8
Member Since: 05/20/03
posted January 27, 2004 5:49 AM

Hi Drake,

I have been wondering if it was possible to do multithreading in VB, for WebServer component. Since, you mention that you have done it, could you pass on the sample.

Thanks in advance.

Cheers.
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted January 27, 2004 9:28 AM

Hi,
Please email sales@dart.com, referencing this thread.
Thanks,
-ken
Reply | PowerTCP WebServer for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX