Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DrWatson is Killing Me
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
DrWatson is Killing Me
Miscellaneous
Thread ID:
00375047
Message ID:
00375047
Views:
48
The following code was ported from a VB example:

* Test Receiver Code
myInputParser=CreateObject('cyFair1.InputParser')
omyFactory=createobject("MyFactory")
public sockfactory
sockfactory=Createobject("S2TCPComms.TCPConnectionFactory")
oVFPCOM=CreateObject("VFPCOM.COMUtil")
oVFPCOM.BindEvents(sockfactory,oMyFactory)
sockfactory.Listen(4500)

DEFINE CLASS MyFactory AS custom
PROCEDURE newConnection
lparameter lcConnection
wait [New Connection Established] window
endproc

Procedure NewMessage
wait [New Message] window
endproc
ENDDEFINE


The purpose is to create a TCP/IP message listener. Once the sockfactory.Listen(4500) executes the program is waiting to receive a message. I've got a VB client that sends messages, it shows it creates the connection and then DR. Watson pops up and VFP6 crashes.
From the vendor's documentation HRESULT Listen(Long) this method indicates that the connection factory should listen for new connections from remote systems on the given port. Any new connections will cause the 'NewConnection' event to be fired." This is my first time using the VFPCOM.DLL so I'm not sure if I'm doing something wrong here. Below is some of the code from the VB Listner that works:

'General Declarations
Public WithEvents sockfactory As TCPConnectionFactory

'Form_Load()
'Create a TCPConnectionFactory and listern on port 4500
Set sockfactory = New TCPConnectionFactory
sockfactory.Listen 4500

Private Sub sockfactory_NewConnection(ByVal connection As S2TCPCOMMSLib.IConnection)
currPeerName = connection.PeerName
frmMain.Text1.Text = currPeerName
End Sub

Thanks for any help
Kirk
Next
Reply
Map
View

Click here to load this message in the networking platform