?
Solved

VB6 "Full Duplex functionality?" ActiveX? Threads?

Posted on 2003-03-17
10
Medium Priority
?
308 Views
Last Modified: 2012-05-05
Hi

I'm working on a small project using VB6 but I've run into a problem. There will be a single client and a single server communicating over TCP/IP in this app. They both have the same functions (called peers?)

The server's ongoing job is to perform very large tasks that result in large amounts of data to be sent to the client (just for example, a sampled wave file compressed using zlib)

The client's ongoing job is to receive the large amount of data, perform tasks upon it (such as decompression, decryption what have you) and present it to the user.

This model works fine, however I want a full duplex style of functionality. The problem at the moment is that whilst say the client is decompressing data, the client is incapable of sampling it's OWN wave file and compressing that data, or even of sending any uncompressed data to the server.

Similarly, the server is "frozen" during compression, or during data transmission. To sum up, I need both the server and the client to have the ability to do the following 2 things at once:

1.) (Sample and encode and send data)

2.) (Receive and decode and present data)

To be as clear as possible:-

The server must be able to "sample for a few seconds and send that sample to zlib" non stop, yet somehow also be instantly ready to receive and decompress data to be presented, even whilst in the middle of compressing outbound data.

-----

I've tried using the CreateThread() in Kernel32 in both VB5 and VB6 (lol that was pleasant) with little success and would prefer to abandon that avenue.

Using timer() and DoEvents didn't seem to work very well for me. As the data is being sent to an external function (say zlib), I don't understand how I can inject DoEvent statements into the execution of compress() as used in Zlib. I.e I merely call it and have no choice but to wait until it returns the compressed data. All the while, the user might be talking into the mic, but nothing is recorded! My problem is that the compression job takes the most time, so switching out of it momentarily only seems possible with threads.

I've thought about migrating it to a c++ project. I have very little knowledge in c++, however I understand java very well and I expected MS Visual C++ to resemble either Borland's JBuilder or Visual Basic 6's IDE. The MS VC++ interface was intimidating! Migrating the project is a last resort option as it'll add weeks
to the development time (as I need to learn it)

I've thought about buying the .Net varient of Visual Basic after reading it has native threads support. This would be an ideal solution even if I couldn't copy and paste lots of code over. How different is VB.Net or VB7 whatever its called? ;)
My only issue is the possibility of needing a common runtime package. I don't want to add 20mb to the download size should I want to put this app up on the web. Can VB7 be used without the common runtime package if the class system of .Net is never used? Are threads part of that class system? Eek...

I've read a few other questions on threading and ActiveX in good old VB6 but I didn't understand very well. Would I need a main ActiveX executable and several ActiveX DLL's in the case of this project?

Would this work:

                   ActiveX Sample, Call Zlib and TCP send.DLL
                  /
ActiveXMain.exe  -
                  \
                   ActiveX Receive, Call Zlib and Present ZLib Caller.DLL
                 
I guess that the sampler dll would also have to be responsible for sending the data over tcpip, and the presenter dll would have to be responsible for collecting data off the stack as the two things need happen at once right?

The threading model options available to ActiveX didn't make much sense to me after reading the Docs. I am a bit new to threads

Any suggestions or ideas would be highly appreciated!
0
Comment
Question by:adox
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 2

Expert Comment

by:nahumd
ID: 8150344
I guess I won't help you alot with that, since it seems that you already know that, but VB6 is certainly not the right platform for programming a project like you described.
You have mentioned that you understand Java very well. Why not writing it in Java, which seems to be a much suitable platform for it ?
0
 
LVL 2

Expert Comment

by:saurabhgupta
ID: 8150353
ActiveX .exe is a very crude way of multithreading. It is very cumbersome and will increase processor usage.
I'd highly recommend using a third party multithreading library.
I'd suggest the Thread Factory multithreading library for VB. Download it from http://www.halfx.com. I have used it and found it to be very robust. It allows you to debug from the VB IDE. It is quite easy to implement and fairly
priced too.

Regards
Saurabh
0
 

Author Comment

by:adox
ID: 8151782
nahumd: I did consider doing it in java, would be a lot easier than learning c++! But for reasons I dont want to go into, java isn't suitable. If it was, I would have finished by now :)

saurabhgupta: I had no idea third party tools existed- The one you mentioned is $200, though I found another for $49 (http://www.topshareware.com/Async-download-57.htm) that I'm considering also (would rather scrape the pennies of course). Lots to choose from, takes time to weigh the pros and cons of each before committing. Thanks for the idea though, a great fallback. You've assured me that I *can* do this in VB if all other plans fail

I've been looking into all the activeX stuff for the past few hours too. I agree with you its a lot more crude looking than java threads, and a lot less control.
However, since the peers need effectivly to be able to compress and decompress a file at the same time, an ActiveX helper dll running in it's own thread is looking ever more so like the cheapest way forward (in time and money)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:adox
ID: 8152746
nahumd: I did consider doing it in java, would be a lot easier than learning c++! But for reasons I dont want to go into, java isn't suitable. If it was, I would have finished by now :)
saurabhgupta: I had no idea third party tools existed- The one you mentioned is $200, though I found another for $49 (http://www.topshareware.com/Async-download-57.htm) that I'm considering also (would rather scrape the pennies of course). Lots to choose from, takes time to weigh the pros and cons of each before committing. Thanks for the idea though, a great fallback. You've assured me that I *can* do this in VB if all other plans fail
I've been looking into all the activeX stuff for the past few hours too. I agree with you its a lot more crude looking than java threads, and a lot less control.
However, since the peers need effectivly to be able to compress and decompress a file at the same time, an ActiveX helper dll running in it's own thread is looking ever more so like the cheapest way forward (in time and money)
0
 

Author Comment

by:adox
ID: 8155139
Just spent the last 6 hours learning how to use ActiveX... I couldn't get it doing exactly what I wanted, woe is me
0
 

Accepted Solution

by:
adox earned 0 total points
ID: 8159190
Another 12 hours and I solved it with ActiveX! The final thing doesnt really multithread of course, but uses a combination of activex doevents plenty of events and timers to have a high cpu load background task running whenever necessary, without disturbing the current window.

Case Solved!
0
 
LVL 2

Expert Comment

by:saurabhgupta
ID: 8159226
Good to hear that. Best of luck!

Regards
Saurabh
0
 

Expert Comment

by:CleanupPing
ID: 8532221
Hi adox,
This old question (QID 20553129) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
 
LVL 6

Expert Comment

by:GPrentice00
ID: 8957052
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

-->PAQ - with points refunded

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

GPrentice00
EE Cleanup Volunteer
0
 

Expert Comment

by:YensidMod
ID: 9023647
Question is PAQ'd and points refunded.

YensidMod
Community Support Moderator @Experts Exchange
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month9 days, 8 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question