ovfpcomm = CREATEOBJECT('vfpCom.comutil') vfpsockevent = NEWOBJECT("_IConnectionFactoryEvents") sockfactory = CREATEOBJECT("S2TCPComms.TCPConnectionFactory.1") ************************************************************************* * Bind the HL7 Message events so that VFP can do something when they * (messages) are received ************************************************************************* ovFpcomm.bindEvents(sockfactory,vfpSockEvent) ************************************************************************* * Tell it which port to listen on and to start listening ************************************************************************* sockfactory.listen(lcPortid)Below is my VB code from the form. Thanks for any pointers.
Imports S2TCPCOMMSLib Public Class MainForm Public WithEvents sockfactory As TCPConnectionFactory Public connection As S2TCPCOMMSLib.IConnection Public isListening As Boolean Public oPBARADTmsg As PBARADT.Message Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click sockfactory = New S2TCPCOMMSLib.TCPConnectionFactory sockfactory.Listen(8888) End Sub Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub connection_ConnectionClosed(ByVal connection As S2TCPCOMMSLib.TCPConnection) Handles sockfactory.ConnectionClosed connection.Disconnect() End Sub Private Sub Connection_NewConnection(ByVal connection As S2TCPCOMMSLib.TCPConnection) Handles sockfactory.NewConnection MsgBox("New Connection") End Sub End Class