?
Solved

Winsock.ocx used in class will not raise DataArrival events - why?

Posted on 2003-03-18
2
Medium Priority
?
323 Views
Last Modified: 2013-12-26
Using VB6.0 sp5 on NT4.0.

I have a class with the following;
Private WithEvents mSocket As Winsock

But the DataArrival Event is not firing within the class.

[Object Browser definition:
 Event DataArrival(bytesTotal As Long)
 Default member of MSWinsockLib.Winsock
 Occurs when data has been received from the remote computer]

Initially I thought it might be due to no actual data having arrived (!). However, I know that it is being sent from the host machine. And more importantly, a third party socket analysing tool (TracePlus/Winsock from www.sstinc.com) allows me to view the expected data arrive on my local buffer, yet still no event is raised within VB.

The SendProgress event is working, as is the Error event. The Host machine is using third party software to actually return the data, but we have successfully connected & I can send data to it which it successfully receives & processes.

It might be worth noting that 1. the control is not on a form & is being instatiated within the class & 2. the use of the Winsock.ocx is to replace old API calls which worked okay, but obviously don't map to the winsock exactly.

(N.b. I would give more points but I've just signed up & 75 doesn't go very far!!)

Thanks
Simon.
0
Comment
Question by:SimonWray
[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
2 Comments
 
LVL 3

Accepted Solution

by:
y2ksw earned 300 total points
ID: 8220283
The OCX *must* me placed on a form, even if it is a dummy form (invisible). From then on it will work. I've had the same problem with a web server. Classes are nice, but won't solve all problems :-)
0
 
LVL 6

Expert Comment

by:GPrentice00
ID: 9053420
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:

 -->Accept y2ksw's comment as Answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER

GPrentice00
Cleanup Volunteer
0

Featured Post

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.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month9 days, 3 hours left to enroll

764 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