Question
· Dec 17

UDP Adapter not working

Hello

I am trying to work with UDP Connection/Adapter and I get this error.

ERREUR #5002: Erreur Cache: <WRITE>zSend+5^EnsLib.UDP.Common.1

 Here is the method
 

Class TEMPLATE.BO.UDPSend Extends Ens.BusinessOperation
{

Parameter ADAPTER = "EnsLib.UDP.OutboundAdapter";

Property Adapter As EnsLib.UDP.OutboundAdapter;

Method SendData(pInput As Ens.Request, Output pOutput As Ens.Response) As %Status
{
    Try {
        Set status=$$$OK
        Set pOutput=##class(Ens.Response).%New()
        
        Set stream = ##class(%Stream.GlobalCharacter).%New()
        Do stream.Write("This is some text")
        $$$LOGINFO(stream.Read())
        Do stream.Rewind()

        Set status = ..Adapter.SendStream(stream)
    }
    Catch exception {
        Set status=exception.AsStatus()
    }    
    Return status
}

XData MessageMap
{
<MapItems>
<MapItem MessageType="Ens.Request">
<Method>SendData</Method>
</MapItem>
</MapItems>
}

}

I have tried with ##class(%Net.UDP).%New() and it is working.

Does anyone have an idea of why it is not working or some example of a functionnal method, please ?

Thanks in advance

Corentin

PS : For those who don't want explore the code to find the line where it generate an error : 

zSend(pDevice="",pBuffer) public { Set:'($data(pBuffer)#2) pBuffer=""
    Set tStatus = 1
    Try {
        Do pBuffer.Rewind()
        Use pDevice Do pBuffer.OutputToDevice()
        Use pDevice Write !
    }
    Catch eSend {
        Set tStatus = eSend.AsStatus()
    }
    Quit tStatus }
Product version: Ensemble 2018.1
$ZV: Cache for Windows (x86-64) 2018.1.4 (Build 505_1U) Thu May 28 2020 10:01:40 EDT
Discussion (0)1
Log in or sign up to continue