15. Januar 2009 19:45
IF ISCLEAR(CC2) THEN
CREATE(CC2);
IF ISCLEAR(SBA) THEN
CREATE(SBA);
SBA.CloseSendWhenWaitForReply(TRUE);
CC2.AddBusAdapter(SBA,0);
OutMsg := CC2.CreateoutMessage(STRSUBSTNO('Sockets://%1:%2',Setup."IP Address",Setup.Port));
OutS := OutMsg.GetStream();
OutMsg.Send(0);
15. Januar 2009 20:56
15. Januar 2009 21:45
15. Januar 2009 22:02
HattrickHorst hat geschrieben:Auch der Debugger springt schon gar nicht da rein.
15. Januar 2009 22:10
15. Januar 2009 22:11
16. Januar 2009 08:51
OBJECT Form 95000 Communication Test
{
OBJECT-PROPERTIES
{
Date=11.12.06;
Time=15:58:44;
Modified=Yes;
Version List=SSI/COM1.00;
}
PROPERTIES
{
Width=8580;
Height=6160;
Sizeable=No;
OnOpenForm=BEGIN
SetControls();
END;
OnQueryCloseForm=BEGIN
IF IsStarted[1] OR IsStarted[2] OR IsStarted[3] THEN
MESSAGE('Caution! Bus Adaptder is/are still loaded (Single Instance).\' +
'Restart the NAV Client to unload.');
END;
}
CONTROLS
{
{ 1000000000;Frame ;220 ;220 ;8140 ;1100 ;HorzGlue=Both;
CaptionML=ENU=Session Type }
{ 1000000001;OptionButton;440;660;3740;440 ;ParentControl=1000000000;
InFrame=Yes;
CaptionML=ENU=Receiver;
SourceExpr=SessionType;
OptionValue=Receiver;
OnAfterValidate=BEGIN
SetControls();
END;
}
{ 1000000003;OptionButton;4400;660;3740;440 ;ParentControl=1000000000;
InFrame=Yes;
CaptionML=ENU=Sender;
SourceExpr=SessionType;
OptionValue=Sender;
OnAfterValidate=BEGIN
SetControls();
END;
}
{ 1000000004;Frame ;220 ;1540 ;8140 ;1320 ;HorzGlue=Both;
CaptionML=ENU=Socket Bus Adapter }
{ 1000000005;CommandButton;440;2090;3740;550;Name=Start_SBA;
ParentControl=1000000004;
InFrame=Yes;
PushAction=RunObject;
CaptionML=ENU=Start SBA;
RunObject=Codeunit 95000;
OnPush=BEGIN
IsStarted[1] := TRUE;
SetControls();
END;
}
{ 1000000006;CommandButton;4400;2090;3740;550;
Name=Send_SBA;
ParentControl=1000000004;
InFrame=Yes;
PushAction=RunObject;
CaptionML=ENU=Send Message;
RunObject=Codeunit 95001 }
{ 1000000002;Shape ;3740 ;2200 ;330 ;330 ;Name=SBA_On;
ParentControl=1000000004;
InFrame=Yes;
BackColor=65280;
BackTransparent=No;
BorderColor=0;
ShapeStyle=Oval }
{ 1000000013;Shape ;3740 ;2200 ;330 ;330 ;Name=SBA_Off;
ParentControl=1000000004;
InFrame=Yes;
BackColor=255;
BackTransparent=No;
BorderColor=0;
ShapeStyle=Oval }
{ 1000000007;Frame ;220 ;3080 ;8140 ;1320 ;HorzGlue=Both;
CaptionML=ENU=Named Pipe Bus Adapter }
{ 1000000008;CommandButton;440;3630;3740;550;Name=Start_NPBA;
ParentControl=1000000007;
InFrame=Yes;
PushAction=RunObject;
CaptionML=ENU=Start NPBA;
RunObject=Codeunit 95002;
OnPush=BEGIN
IsStarted[2] := TRUE;
SetControls();
END;
}
{ 1000000009;CommandButton;4400;3630;3740;550;
Name=Send_NPBA;
ParentControl=1000000007;
InFrame=Yes;
PushAction=RunObject;
CaptionML=ENU=Send Message;
RunObject=Codeunit 95003 }
{ 1000000014;Shape ;3740 ;3740 ;330 ;330 ;Name=NPBA_On;
ParentControl=1000000007;
InFrame=Yes;
BackColor=65280;
BackTransparent=No;
BorderColor=0;
ShapeStyle=Oval }
{ 1000000015;Shape ;3740 ;3740 ;330 ;330 ;Name=NPBA_Off;
ParentControl=1000000007;
InFrame=Yes;
BackColor=255;
BackTransparent=No;
BorderColor=0;
ShapeStyle=Oval }
{ 1000000010;Frame ;220 ;4620 ;8140 ;1320 ;HorzGlue=Both;
CaptionML=ENU=Message Queue Bus Adapter }
{ 1000000011;CommandButton;440;5170;3740;550;Name=Start_MSQBA;
ParentControl=1000000010;
InFrame=Yes;
PushAction=RunObject;
CaptionML=ENU=Start MSQBA;
RunObject=Codeunit 95004;
OnPush=BEGIN
IsStarted[3] := TRUE;
SetControls();
END;
}
{ 1000000012;CommandButton;4400;5170;3740;550;
Name=Send_MSQBA;
ParentControl=1000000010;
InFrame=Yes;
PushAction=RunObject;
CaptionML=ENU=Send Message;
RunObject=Codeunit 95005 }
{ 1000000016;Shape ;3740 ;5280 ;330 ;330 ;Name=MSQBA_On;
ParentControl=1000000010;
InFrame=Yes;
BackColor=65280;
BackTransparent=No;
BorderColor=0;
ShapeStyle=Oval }
{ 1000000017;Shape ;3740 ;5280 ;330 ;330 ;Name=MSQBA_Off;
ParentControl=1000000010;
InFrame=Yes;
BackColor=255;
BackTransparent=No;
BorderColor=0;
ShapeStyle=Oval }
}
CODE
{
VAR
SessionType@1000000000 : 'Receiver,Sender';
IsStarted@1000000001 : ARRAY [3] OF Boolean;
PROCEDURE SetControls@1000000005();
BEGIN
CurrForm.Start_SBA.ENABLED(SessionType = SessionType::Receiver);
CurrForm.Send_SBA.ENABLED(SessionType = SessionType::Sender);
CurrForm.Start_NPBA.ENABLED(SessionType = SessionType::Receiver);
CurrForm.Send_NPBA.ENABLED(SessionType = SessionType::Sender);
CurrForm.Start_MSQBA.ENABLED(SessionType = SessionType::Receiver);
CurrForm.Send_MSQBA.ENABLED(SessionType = SessionType::Sender);
CurrForm.SBA_On.VISIBLE(IsStarted[1] AND (SessionType = SessionType::Receiver));
CurrForm.SBA_Off.VISIBLE((NOT IsStarted[1]) AND (SessionType = SessionType::Receiver));
CurrForm.NPBA_On.VISIBLE(IsStarted[1] AND (SessionType = SessionType::Receiver));
CurrForm.NPBA_Off.VISIBLE((NOT IsStarted[2]) AND (SessionType = SessionType::Receiver));
CurrForm.MSQBA_On.VISIBLE(IsStarted[1] AND (SessionType = SessionType::Receiver));
CurrForm.MSQBA_Off.VISIBLE((NOT IsStarted[3]) AND (SessionType = SessionType::Receiver));
END;
BEGIN
END.
}
}
OBJECT Codeunit 95000 Ex.: Socket Receive
{
OBJECT-PROPERTIES
{
Date=11.12.06;
Time=15:56:21;
Modified=Yes;
Version List=SSI/COM1.00;
}
PROPERTIES
{
SingleInstance=Yes;
OnRun=BEGIN
IP := '127.0.0.1'; // Local Host
Port := 8079;
InitInterface();
END;
}
CODE
{
VAR
SBA@1000000003 : Automation "{CF450AFF-91CE-4DF0-92DE-AFE4C28AAFC7} 1.0:{4CBE9566-34EA-429D-963A-911E270CBE4F}:'Navision Socket Bus Adapter'.SocketBusAdapter";
CC2@1000000002 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{01018FA5-E4B4-413C-A47C-AD34B0CC2647}:'Navision Communication Component version 2'.CommunicationComponent" WITHEVENTS;
InMsg@1000000001 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{D184D0AC-61C9-4AC1-B537-0D28C277FEDE}:'Navision Communication Component version 2'.InMessage";
IP@1000000000 : Text[30];
Port@1000000004 : Integer;
InS@1000000005 : InStream;
Text@1000000006 : Text[1024];
PROCEDURE InitInterface@1000000000();
BEGIN
IF ISCLEAR(CC2) THEN
CREATE(CC2);
IF ISCLEAR(SBA) THEN
CREATE(SBA);
CC2.AddBusAdapter(SBA, 0);
SBA.Address := IP;
SBA.OpenSocket(Port, '');
MESSAGE('Socket Bus Adapter is started.');
END;
PROCEDURE GetMessage@1000000001();
BEGIN
InS := InMsg.GetStream();
WHILE NOT InS.EOS DO BEGIN
InS.READ(Text);
MESSAGE('SBA:\' + Text);
END;
InMsg.CommitMessage();
END;
EVENT CC2@1000000002::MessageReceived@1(VAR InMessage@1000000000 : Automation ":{00020400-0000-0000-C000-000000000046}:''.IDISPATCH");
BEGIN
BEEP(500, 50);
InMsg := InMessage;
GetMessage();
END;
BEGIN
{
*********************************************************
*** STRYK System Improvement ***
*** Performance Optimization & Troubleshooting ***
*** (c) 2006, STRYK System Improvement, J”rg Stryk ***
*** Contact: Contact@Stryk.info ***
*********************************************************
}
END.
}
}
OBJECT Codeunit 95001 Ex.: Socket Send
{
OBJECT-PROPERTIES
{
Date=11.12.06;
Time=15:38:23;
Modified=Yes;
Version List=SSI/COM1.00;
}
PROPERTIES
{
OnRun=BEGIN
IP := '127.0.0.1'; // Local Host
Port := 8079;
InitInterface();
SendMessage();
END;
}
CODE
{
VAR
SBA@1000000003 : Automation "{CF450AFF-91CE-4DF0-92DE-AFE4C28AAFC7} 1.0:{4CBE9566-34EA-429D-963A-911E270CBE4F}:'Navision Socket Bus Adapter'.SocketBusAdapter";
CC2@1000000002 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{01018FA5-E4B4-413C-A47C-AD34B0CC2647}:'Navision Communication Component version 2'.CommunicationComponent";
OutMsg@1000000001 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{6CB9762C-E61C-4F96-BA34-8B20D3A5B46E}:'Navision Communication Component version 2'.OutMessage";
IP@1000000000 : Text[30];
Port@1000000004 : Integer;
OutS@1000000005 : OutStream;
PROCEDURE InitInterface@1000000000();
BEGIN
IF ISCLEAR(CC2) THEN
CREATE(CC2);
IF ISCLEAR(SBA) THEN
CREATE(SBA);
CC2.AddBusAdapter(SBA, 0);
END;
PROCEDURE SendMessage@1000000001();
BEGIN
OutMsg := CC2.CreateoutMessage(STRSUBSTNO('Sockets://%1:%2', IP, Port));
OutS := OutMsg.GetStream();
OutS.WRITETEXT('Hello World!');
OutMsg.Send(0);
MESSAGE('Message has been sent via Socket Bus Adapter.');
END;
EVENT CC2@1000000002::MessageReceived@1(VAR InMessage@1000000000 : Automation ":{00020400-0000-0000-C000-000000000046}:''.IDISPATCH");
BEGIN
END;
BEGIN
{
*********************************************************
*** STRYK System Improvement ***
*** Performance Optimization & Troubleshooting ***
*** (c) 2006, STRYK System Improvement, J”rg Stryk ***
*** Contact: Contact@Stryk.info ***
*********************************************************
}
END.
}
}
OBJECT Codeunit 95002 Ex.: Named Pipe Receive
{
OBJECT-PROPERTIES
{
Date=11.12.06;
Time=15:56:29;
Modified=Yes;
Version List=SSI/COM1.00;
}
PROPERTIES
{
SingleInstance=Yes;
OnRun=BEGIN
Pipe := 'Test'; // Local Host
InitInterface();
END;
}
CODE
{
VAR
NPA@1000000003 : Automation "{DE02F245-15B6-42D1-BA8F-5958814EF71D} 1.0:{B9D54055-572C-41E3-879A-C9845E963494}:'Navision Named Pipe Bus Adapter'.NamePipeBusAdapter";
CC2@1000000002 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{01018FA5-E4B4-413C-A47C-AD34B0CC2647}:'Navision Communication Component version 2'.CommunicationComponent" WITHEVENTS;
InMsg@1000000001 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{D184D0AC-61C9-4AC1-B537-0D28C277FEDE}:'Navision Communication Component version 2'.InMessage";
Pipe@1000000000 : Text[30];
InS@1000000005 : InStream;
Text@1000000006 : Text[1024];
PROCEDURE InitInterface@1000000000();
BEGIN
IF ISCLEAR(CC2) THEN
CREATE(CC2);
IF ISCLEAR(NPA) THEN
CREATE(NPA);
CC2.AddBusAdapter(NPA, 0);
NPA.OpenNamedPipe(Pipe, 0, 0);
MESSAGE('Named Pipe Bus Adapter is started.');
END;
PROCEDURE GetMessage@1000000001();
BEGIN
InS := InMsg.GetStream();
WHILE NOT InS.EOS DO BEGIN
InS.READ(Text);
MESSAGE('NPBA:\' + Text);
END;
InMsg.CommitMessage();
END;
EVENT CC2@1000000002::MessageReceived@1(VAR InMessage@1000000000 : Automation ":{00020400-0000-0000-C000-000000000046}:''.IDISPATCH");
BEGIN
BEEP(500, 50);
InMsg := InMessage;
GetMessage();
END;
BEGIN
{
*********************************************************
*** STRYK System Improvement ***
*** Performance Optimization & Troubleshooting ***
*** (c) 2006, STRYK System Improvement, J”rg Stryk ***
*** Contact: Contact@Stryk.info ***
*********************************************************
}
END.
}
}
OBJECT Codeunit 95003 Ex.: Named Pipe Send
{
OBJECT-PROPERTIES
{
Date=11.12.06;
Time=15:38:32;
Modified=Yes;
Version List=SSI/COM1.00;
}
PROPERTIES
{
OnRun=BEGIN
Pipe := '\\.\pipe\Test'; // Local Host
InitInterface();
SendMessage();
END;
}
CODE
{
VAR
NPA@1000000003 : Automation "{DE02F245-15B6-42D1-BA8F-5958814EF71D} 1.0:{B9D54055-572C-41E3-879A-C9845E963494}:'Navision Named Pipe Bus Adapter'.NamePipeBusAdapter";
CC2@1000000002 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{01018FA5-E4B4-413C-A47C-AD34B0CC2647}:'Navision Communication Component version 2'.CommunicationComponent";
OutMsg@1000000001 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{6CB9762C-E61C-4F96-BA34-8B20D3A5B46E}:'Navision Communication Component version 2'.OutMessage";
Pipe@1000000000 : Text[30];
OutS@1000000005 : OutStream;
PROCEDURE InitInterface@1000000000();
BEGIN
IF ISCLEAR(CC2) THEN
CREATE(CC2);
IF ISCLEAR(NPA) THEN
CREATE(NPA);
CC2.AddBusAdapter(NPA, 0);
END;
PROCEDURE SendMessage@1000000001();
BEGIN
OutMsg := CC2.CreateoutMessage(STRSUBSTNO('Named Pipe://%1', Pipe));
OutS := OutMsg.GetStream();
OutS.WRITETEXT('Hello World!');
OutMsg.Send(0);
MESSAGE('Message has been sent via Named Pipe Bus Adapter.');
END;
EVENT CC2@1000000002::MessageReceived@1(VAR InMessage@1000000000 : Automation ":{00020400-0000-0000-C000-000000000046}:''.IDISPATCH");
BEGIN
END;
BEGIN
{
*********************************************************
*** STRYK System Improvement ***
*** Performance Optimization & Troubleshooting ***
*** (c) 2006, STRYK System Improvement, J”rg Stryk ***
*** Contact: Contact@Stryk.info ***
*********************************************************
}
END.
}
}
OBJECT Codeunit 95004 Ex.: Message Queue Receive
{
OBJECT-PROPERTIES
{
Date=11.12.06;
Time=15:56:37;
Modified=Yes;
Version List=SSI/COM1.00;
}
PROPERTIES
{
SingleInstance=Yes;
OnRun=BEGIN
Queue := '.\test';
InitInterface();
END;
}
CODE
{
VAR
CC2@1000000001 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{01018FA5-E4B4-413C-A47C-AD34B0CC2647}:'Navision Communication Component version 2'.CommunicationComponent" WITHEVENTS;
MSQ@1000000000 : Automation "{B8BD635A-E191-47EF-84A0-02921E2A44A6} 1.0:{CD49794B-0E84-4A2E-9522-C518C825D390}:'Navision MS-Message Queue Bus Adapter'.MSMQBusAdapter";
InMsg@1000000002 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{D184D0AC-61C9-4AC1-B537-0D28C277FEDE}:'Navision Communication Component version 2'.InMessage";
InS@1000000003 : InStream;
Queue@1000000004 : Text[30];
Text@1000000005 : Text[1024];
PROCEDURE InitInterface@1000000000();
BEGIN
IF ISCLEAR(CC2) THEN
CREATE(CC2);
IF ISCLEAR(MSQ) THEN
CREATE(MSQ);
CC2.AddBusAdapter(MSQ, 1);
MSQ.OpenReceiveQueue(Queue, 0, 0);
MESSAGE('Message Queue Bus Adapter is started.');
END;
PROCEDURE GetMessage@1000000001();
BEGIN
InS := InMsg.GetStream();
WHILE NOT InS.EOS DO BEGIN
InS.READ(Text);
MESSAGE('MSQBA:\' + Text);
END;
InMsg.CommitMessage();
END;
EVENT CC2@1000000001::MessageReceived@1(VAR InMessage@1000000000 : Automation ":{00020400-0000-0000-C000-000000000046}:''.IDISPATCH");
BEGIN
BEEP(500, 50);
InMsg := InMessage;
GetMessage();
END;
BEGIN
{
*********************************************************
*** STRYK System Improvement ***
*** Performance Optimization & Troubleshooting ***
*** (c) 2006, STRYK System Improvement, J”rg Stryk ***
*** Contact: Contact@Stryk.info ***
*********************************************************
}
END.
}
}
OBJECT Codeunit 95005 Ex.: Message Queue Send
{
OBJECT-PROPERTIES
{
Date=11.12.06;
Time=15:39:04;
Modified=Yes;
Version List=SSI/COM1.00;
}
PROPERTIES
{
OnRun=BEGIN
Queue := '.\test';
InitInterface();
SendMessage();
END;
}
CODE
{
VAR
CC2@1000000001 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{01018FA5-E4B4-413C-A47C-AD34B0CC2647}:'Navision Communication Component version 2'.CommunicationComponent";
MSQ@1000000000 : Automation "{B8BD635A-E191-47EF-84A0-02921E2A44A6} 1.0:{CD49794B-0E84-4A2E-9522-C518C825D390}:'Navision MS-Message Queue Bus Adapter'.MSMQBusAdapter";
OutMsg@1000000002 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{6CB9762C-E61C-4F96-BA34-8B20D3A5B46E}:'Navision Communication Component version 2'.OutMessage";
OutS@1000000003 : OutStream;
Queue@1000000004 : Text[30];
PROCEDURE InitInterface@1000000000();
BEGIN
IF ISCLEAR(CC2) THEN
CREATE(CC2);
IF ISCLEAR(MSQ) THEN
CREATE(MSQ);
CC2.AddBusAdapter(MSQ, 1);
MSQ.OpenWriteQueue(Queue, 0, 0);
END;
PROCEDURE SendMessage@1000000001();
BEGIN
OutMsg := CC2.CreateoutMessage(STRSUBSTNO('Message queue://%1', Queue));
OutS := OutMsg.GetStream();
OutS.WRITE('Hello World!');
OutMsg.Send(0);
MESSAGE('Message has been sent via Message Queue Bus Adapter.');
END;
EVENT CC2@1000000001::MessageReceived@1(VAR InMessage@1000000000 : Automation ":{00020400-0000-0000-C000-000000000046}:''.IDISPATCH");
BEGIN
END;
BEGIN
{
*********************************************************
*** STRYK System Improvement ***
*** Performance Optimization & Troubleshooting ***
*** (c) 2006, STRYK System Improvement, J”rg Stryk ***
*** Contact: Contact@Stryk.info ***
*********************************************************
}
END.
}
}
16. Januar 2009 09:33
CREATE(CC2);
CREATE(SBA);
CC2.AddBusAdapter(SBA,0);
//SBA.ReceivingTimeout(2000);
IF Port=0 THEN
Port:=9000;
SBA.OpenSocket(Port,'');
SBA.CloseSendWhenWaitForReply :=FALSE;
16. Januar 2009 10:10
16. Januar 2009 10:42
16. Januar 2009 10:59
16. Januar 2009 11:08
16. Januar 2009 11:37
16. Januar 2009 11:54
16. Januar 2009 12:12
16. Januar 2009 12:30
16. Januar 2009 12:39
3. Februar 2009 13:35