Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with code
Message
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Help with code
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01073331
Message ID:
01073331
Vues:
49
I have a winform that has one button in it. In the click() event, I want to create a TCPIP listener that receives HL7 messages. I have a COM component that I use in FOXPRO without any problems that creates a connection and listens on a port. But in VB I can't figure out the correct way to declare it. In VFP I just do the following:
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform