17. Juli 2013 15:53
OBJECT Codeunit 50051 Send IP Port mit Reply
{
OBJECT-PROPERTIES
{
Date=17.07.13;
Time=15:44:58;
Modified=Yes;
Version List=RUB.BU;
}
PROPERTIES
{
SingleInstance=Yes;
OnRun=BEGIN
Send('em-paketwaage',8000);
END;
}
CODE
{
VAR
CC2@1000000000 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{01018FA5-E4B4-413C-A47C-AD34B0CC2647}:'Navision Communication Component version 2'.CommunicationComponent" WITHEVENTS;
SBA@1000000001 : Automation "{CF450AFF-91CE-4DF0-92DE-AFE4C28AAFC7} 1.0:{4CBE9566-34EA-429D-963A-911E270CBE4F}:'Navision Socket Bus Adapter'.SocketBusAdapter";
OutMsg@1000000002 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{6CB9762C-E61C-4F96-BA34-8B20D3A5B46E}:'Navision Communication Component version 2'.OutMessage";
ReplyMsg@1000000004 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{D184D0AC-61C9-4AC1-B537-0D28C277FEDE}:'Navision Communication Component version 2'.InMessage";
OutS@1000000003 : OutStream;
InStrm@1000000006 : InStream;
Reply@1000000005 : Boolean;
txt@1000000007 : Text[1000];
retval@1000000008 : Integer;
PROCEDURE Send@1000000000(Receiver@1000000000 : Text[30];Port@1000000001 : Integer);
BEGIN
IF ISCLEAR(CC2) THEN
CREATE(CC2);
IF ISCLEAR(SBA) THEN
CREATE(SBA);
CC2.AddBusAdapter(SBA, 0);
OutMsg:= CC2.CreateoutMessage('Sockets://' + Receiver + ':' + FORMAT(Port));
OutS:= OutMsg.GetStream();
OutS.WRITE('l11');
ReplyMsg := OutMsg.SendWaitForReply(5000);
InStrm := ReplyMsg.GetStream;
WHILE NOT (InStrm.EOS) DO
BEGIN
InStrm.READ(txt);
MESSAGE(txt);
END;
MESSAGE(txt);
ReplyMsg.CommitMessage;
MESSAGE('fertig');
END;
EVENT CC2@1000000000::MessageReceived@1(VAR InMessage@1000000000 : Automation ":{00020400-0000-0000-C000-000000000046}:''.IDISPATCH");
BEGIN
SLEEP(1)
END;
BEGIN
END.
}
}
6. Februar 2014 17:43