Sending a text by TCP
Hello gentlemen,
I have to create a objectscript program that will simulate a mainframe (because it's going to be removed). For my program, I receive data from another program that is written in Delphy by TCP on a preset socket. Here is my problem, how can I handle this?
Which class shoud my program extend?
Which Adapter should I use?
My program must be able to read what the delphy one is sending and i don't really know what structure it is in what it is in. So is there a class that can allow me to read it? Thanks for your future anwers.
Here is a sample of what I have thought but doesn't work.
Class citadelle.test.ListenningToNewDoc Extends Ens.BusinessService
{
Property TargetConfigNames As %String(MAXLEN = 1000);
Property MotClefTcpText As %String;
Parameter SETTINGS = "MotClefTcpText:Basic, TargetConfigNames:Basic:selector?multiSelect=1&context={Ens.ContextSearch/ProductionItems?targets=1&productionName=@productionId},SendAcknowledgement:Connection,GetStreamName:Connection";
Parameter ADAPTER = "EnsLib.TCP.PassthroughService";
Method OnProcessInput(pInput As %Stream.Object, Output pOutput As %RegisteredObject) As %Status
{
s sc=$$$OK
$$$TRACE("Ik ben hier")
q sc
}
//Method OnInit() As %Status
//{
// s ..Adapter.Terminators=$C(13,28)
// q ##super()
//}
Method resolveAndIndex(pDoc As %Persistent) As %Status
{
Quit $$$OK
}
ClassMethod OnGetConnections(Output pArray As %String, pItem As Ens.Config.Item)
{
Do ##super(.pArray,pItem)
If pItem.GetModifiedSetting("TargetConfigNames",.tValue) {
For i=1:1:$L(tValue,",") {
Set tOne=$ZStrip($P(tValue,",",i),"<>W")
Continue:""=tOne Set pArray(tOne)="" }
}
}
}
Faithfully,
Thomas
Comments
Here is the 2 errors I receive by just lauching my code into a connector.
ERREUR <Ens>ErrException: <UNDEFINED>zinitConfig+4 ^Ens.Host.1 *pConfigName -- - connecté en tant que '-' numéro - @' Set ..%ConfigName = pConfigName'
ERREUR <Ens>ErrException: <INVALID OREF>zinitConfig+8 ^Ens.Host.1 -- - connecté en tant que '-' numéro - @' Set ..Adapter.BusinessHost = $this
Comment out OnGetConnections method and restart the service.
Do you still get errors?
if I comment out OnGetConnections, I still get these errors
How do you launch the code?
Hi
Could you please check if you are using the correct adapter?
I can see in your code this: Parameter ADAPTER = "EnsLib.TCP.PassthroughService" which is not an adapter but a business service.
Maybe you want to use the EnsLib.TCP.CountedInboundAdapter or probably the EnsLib.TCP.TextLineInboundAdapter ?
Regards
Stelios
Thanks Stelios,
you are right, the one i should have used was EnsLib.TCP.TextLineInboundAdapter .
Thanks all for responding me.