NetReceiveAssociateRequest Example for VB.NET
'LEADDICOMNet1 is a predefined LEADDicomNet object 'This example uses the predefined variable "List2" of type "ListBox" from ".NET Framework".
Private Sub LEADDICOMNet1_NetReceiveAssociateRequest(ByVal hNet As Integer, ByVal hPDU As Integer) Handles LEADDICOMNet1.NetReceiveAssociateRequest
Dim
x As Integer
Dim nID
As Short
Dim nResult
As Short
Dim szAbstract
As String
Dim szTransfer
As String
'we
have received an AssociateRequest
List2.Items.Add("Associate
Request was received")
'check the version, if not 1, reject it
If (LEADDICOMNet1.GetVersion(hPDU) <> 1) Then
LEADDICOMNet1.SendAssociateReject(hNet, LTDNCLib.AssociateRejectConstants.PDU_REJECT_RESULT_PERMANENT, LTDNCLib.AssociateRejectConstants.PDU_REJECT_SOURCE_USER, LTDNCLib.AssociateRejectConstants.PDU_REJECT_REASON_UNKNOWN)
Else
'send associate accept class back
LEADDICOMNet1.CreateAssociate(False)
LEADDICOMNet1.ResetAssociate(LEADDICOMNet1.hPDU, False)
'copy all presentation objects from received hPDU
'also, reply that we only support the first Transfer Syntax from the received hPDU
For x = 0 To LEADDICOMNet1.GetPresentationCount(hPDU) - 1
nID = LEADDICOMNet1.GetPresentationID(hPDU, x)
szTransfer = LEADDICOMNet1.GetTransferSyntax(hPDU, nID, 0)
nResult = LTDNCLib.AssociateAcceptConstants.PDU_ACCEPT_RESULT_SUCCESS
szAbstract = LEADDICOMNet1.GetPresentationAbstract(hPDU, nID)
LEADDICOMNet1.AddPresentation(LEADDICOMNet1.hPDU, nID, nResult, szAbstract)
LEADDICOMNet1.AddTransferSyntax(LEADDICOMNet1.hPDU, nID, szTransfer)
Next
LEADDICOMNet1.SendAssociateAccept(hNet)
LEADDICOMNet1.FreeAssociate(LEADDICOMNet1.hPDU)
End If
End Sub