Re: VB6 Winsock action on Server
- From: "Schmidt" <sss@xxxxxxxxx>
- Date: Fri, 26 May 2006 20:24:40 +0200
"jerry_ys" <jerryys@xxxxxxxxxxxxxxxxxxxxxxxxx> schrieb im Newsbeitrag
news:5107B4E6-5E19-43AA-BBCE-6C31E01E8ECB@xxxxxxxxxxxxxxxx
...Easiest way is, to delegate each request to a separate instance
my usage of server app I meant the app on the server
that uses the control array and it then calls a dll for further
processing on the same server. It is this piece 'dll' that i
question if it will keep each request on the control array
in sync when it returns a response back to the calling exe
on the server.
of your 'dll' (assuming it is an ActiveX-Dll? - a Standard-Dll
could be wrapped in an AX-Dll).
Each separate "Winsock-Array-Requesthandler" should delegate
the recieved "JobData" to this unique instance of your Dll(-Class).
Ok, as long as you stay singlethreaded, it would be possible, to
use only one instance of this Dll (if there's only one single Method,
wich would be called in each request and the Dll-Design is really
stateless).
But if you plan, to handle multiple client-requests "in parallel", then
forget about this "single-instance-sharing" and give each request its
own Dll-Instance (ideally running on its own thread).
Also the server app with the control array assumes that manyIt's your choice, wich way to go, regarding multithreading in VB.
clients are being processed simultaneously
is there any settings for the active exe, or dll for threading?
Easiest way is, to use an ActiveX-Exe - inside it, you can use the
CreateObject-Call, to instantiate Public AX-Exe-Classes on their
own threads. Inside each of these "ThreadObjects" you can create
separate "WorkHorse-Instances" of your above mentioned 'dll'.
Here my 10 step "Mini-Tutorial" for Threading in AX-Exes:
http://tinyurl.com/rvhjo
Another possibility is, to do CreateThread-based Threading using
Standard-Exes - here you could instantiate Public classes from your
Worker-'dll' directly on new threads and delegate the received
"Jobs" from the SocketArray into the Threads using SharedArrays.
An example, how to use the CreatThreadAPI in a secure way:
(including a SharedArray-Demo and the usage of CriticalSections)
www.datenhaus.de/Downloads/CreateThreadAPI.zip
Will there be a difference if the dll is first with the controlThe overhead from the additional "Public-Class-Layer" in an AX-Exe
array instead of the active exe and it calls the active exe?
is not so big - I personally prefer the CreateThread-API solution
in VB-Standard-Exes, because of its "NoSurprises"-behaviour.
ActiveX-Exes have to be registered (sometimes causes problems,
especially if your Public-Classes aren't "interface-stable" yet) and
care must be taken, to avoid blocking issues with the marshaled
(and implicitely queued) COM-Requests into the ThreadClasses.
One word about the Winsock-OCX in Threading-Scenarios:
You cannot accept WinSockOCX-Instances on different threads
using the RequestID from the listening socket in the MainThread.
If you want to send the Response-Data of your processed Jobs
back to your Clients directly from *inside* the WorkerThreads,
you will have to deal with the Winsock-API directly.
If you then (after a while) got simple "Reflection-Requests" (usually
based on Strings) running in a small Stress-Test in parallel from
different Clients, then you probably think about a more generic
Handling, wich allows "Remote-Request-Params + Results" in a
generic way, with all the possible, wellknown (simple) VB-Types.
After you have implemented that, and managed, to run the whole
thing as a Windows-Service, you probably ask about running the
requests from different Clients in different Contexts (authenticated
DB-Requests - Filesystem-Access, etc. come to mind) and not
under the Context, your Windows-Service is currently running.
Then you could ask about compressing your Request-Results (e.g.
serialized disconnected Recordsets can get quite large) or you want
to use your Server from outside (over the Internet) and you begin to
think about authenticated and encrypted Requests.
Now, if you want to shorten your developement - you could use an
already existing solution, wich is free (you are allowed to deploy all
the needed binaries with no restrictions).
Over the last years we have managed all the issues described above
and ended up in exactly the solution, wich you are about to program
yourself.
It is implemented based on VB6 and allows the usage of VB5/VB6
COM-Dlls across Network-Boundaries:
www.datenhaus.de/Downloads/dh_RPC.zip
(Complete with a well-commented Demo).
The features in short:
- No Interface-Registration needed - respective no COM-Proxies
(neither at the ClientSide, nor at the ServerSide)
- Win-Authentication (and Impersonation of RPCs)
at Connection-Level
- Built-In Compression (ZLib-based)
- Built-In Strong-Encryption (320 Bit ArcFour and
MITM-safed Diffie-Hellman-Auth/KeyExchange)
- Stateful Objects (Singleton-Creation on separate Threads)
- Solid performance: e.g. 3000 COM-Req/s from 6 different
Client-Machines (500 Req/s on each single Connection),
generating 55% ProcessorLoad on a DualAthlon (2GHz).
Of course you could also use the already builtin services, wich the
WinOS already has to offer - the usage of DCOM/COM+ would
allow you a (more or less) similar solution, but this would require
(from my experience) a greater learning-effort, to master/workaround
all the usual snares.
Olaf
.
- Follow-Ups:
- Re: VB6 Winsock action on Server
- From: jerry_ys
- Re: VB6 Winsock action on Server
- References:
- Re: VB6 Winsock action on Server
- From: Phill W.
- Re: VB6 Winsock action on Server
- Prev by Date: Re: Readfile for visual basic
- Next by Date: Re: fastest way to change case of string
- Previous by thread: Re: VB6 Winsock action on Server
- Next by thread: Re: VB6 Winsock action on Server
- Index(es):
Relevant Pages
|