Host Engineering Forum

General Category => ECOMs and ECOM100s => Topic started by: Buzz on September 09, 2010, 12:14:01 PM

Title: report by exception, Visual Basic?
Post by: Buzz on September 09, 2010, 12:14:01 PM
Is it possible to receive data from the ECOM100 using a Visual Basic 6 application (via VB's WinSock control) in a manner similar to how (viewer.exe) does with the report by exception's C++ code?
Title: Re: report by exception, Visual Basic?
Post by: Greg on September 10, 2010, 02:28:25 PM
It is possible, but we don't have an example of it. There are customers who have done this. Perhaps you can look at the C++ code of Viewer.EXE and figure that out? If so, you can let us know and we'll give your working example to other VB6 users that might need it.  :)
Title: Re: report by exception, Visual Basic?
Post by: Buzz on September 10, 2010, 06:03:10 PM
I have my VB app listening on socket or port number 30583.  I also have the VB WinSock protocol set to TCP/IP but none of the VB WinSock connection events fire when I trigger them from the ECOM100, no error events either.  It's as if nothing, WinSock related, is happening at all. I know the ECOM100 is indeed sending packets back to my PC because the C++ 'viewer.exe' receives / displays them. 

viewer.exe's caption always denotes UDP and will only receive data when its protocol is set to UDP.  NetEdit3.exe only finds the ECOM when set to TCP/IP.  Does anyone know why viewer.exe has to use UDP and NetEdit3.exe has to use TCP/IP?
Title: Re: report by exception, Visual Basic?
Post by: franji1 on September 11, 2010, 01:16:09 PM
Actually, NetEdit does use UDP/IP, but people are familiar with the term TCP/IP, and in this industry, Ethernet/IP means something totally different than Internet Protocol.
Title: Re: report by exception, Visual Basic?
Post by: BobO on September 13, 2010, 10:14:04 AM
TCP/IP is generally regarded to be the proper name of the stack. TCP is a specific subset of TCP/IP, as is UDP. All of Host's protocols use UDP, as datagrams most closely parallel the packet based protocols that are generally used in automation.
Title: Re: report by exception, Visual Basic?
Post by: Buzz on September 13, 2010, 02:46:21 PM
It is possible, but we don't have an example of it. There are customers who have done this. Perhaps you can look at the C++ code of Viewer.EXE and figure that out? If so, you can let us know and we'll give your working example to other VB6 users that might need it.  :)


After reading franji1's and BobO's replies. .  I played around with my VB app's WinSock settings and I'm now receiving 'report by exception' data from the ECOM100 using the UDP protocol (Visual Basic 6)

This is how its works in VB. I have a form with a WinSock control named "ECOM_WinSock"  The Form's load event looks like this.

Private Sub Form_Load()
    Me.ECOM_WinSock.Protocol = sckUDPProtocol
    Me.ECOM_WinSock.Bind 30583
End Sub
When the ECOM100 sends data to my PC the 'ECOM_WinSock_DataArrival' event is triggered. The data is retrieved via the 'GetData' method.  I'm also able to know which ECOM device the data came from by reading the 'ECOM_WinSock.RemoteHostIP' property. Read the 'RemoteHostIP' value from within the 'DataArrival' procedure, at same moment the 'DataArrival' event fires.  Thanks! I'm sort of in disbelief at how easy this is looking today.  ;D

Title: Re: report by exception, Visual Basic?
Post by: franji1 on September 13, 2010, 02:49:45 PM
Thanks! I'm sort of in disbelief at how easy this is looking today.  ;D
Thank YOU for sticking with it!
Title: Re: report by exception, Visual Basic?
Post by: Greg on September 13, 2010, 04:08:38 PM
Awesome, Buzz! I'll make this available to others.  :D