mibuso.com

Microsoft Business Solutions online community
It is currently Sun May 19, 2013 6:52 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Send TCP Port a command
PostPosted: Mon Mar 03, 2008 6:54 pm 
Offline

Joined: Wed Jan 14, 2004 8:45 pm
Posts: 238
Location: Canada
Country: Canada (ca)
Hi,

I could not find an answer in the forum so I am hoping someone has come across it before.

I have to send data to a scale through a TCP Port. I will be sending an IP address, port number, and then a command as text.

Has anyone done this before?

I am thinking it should be as simple as decalring some variable, and then two lines of code like:

somevariable.open('192.168.1.15::52200');
somevariable.write('w.261.2' + formaT(weight));


Does anyone know how to open a TCP Port (I hope I am using the terminology proprely) and send this command?

Thanks,

-a


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 04, 2008 7:44 am 
Offline
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Thu Oct 16, 2003 8:50 am
Posts: 12265
Location: Brno
Country: Czech Republic (cz)
Look to the Communication Components for NAV. If you will find file "devguide.chm", you will find this example:
Quote:
The Navision Socket Bus Adapter - Sending a Document
In this example, we use a codeunit to initialize the Navision Communication Component, establish contact to the Navision Socket Bus Adapter, open a socket server for the bus adapter and send the message.

For the purpose of this example, we have defined the following variables:

Variable Name
Data Type
Subtype
Length

CC2
Automation
'Navision Communication Component version 2'.CommunicationComponent


SBA
Automation
'Navision Socket Bus Adapter'.SocketBusAdapter


OutMsg
Automation
'Navision Communication Component version 2'.OutMessage


OutS
OutStream




The socket server uses port 8079 on the local machine.

Example
OnRun()

IF ISCLEAR(CC2) THEN
CREATE(CC2);
IF ISCLEAR(SBA) THEN
CREATE(SBA);

CC2.AddBusAdapter(SBA, 0);
OutMsg:= CC2.CreateoutMessage('Sockets://localhost:8079');

OutS:= OutMsg.GetStream();
OutS.WRITE('First Text');
OutS.WRITE('Second Text');
OutS.WRITE('Third Text');

OutMsg.Send(0);



_________________
Kamil Sacek
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.


Top
 Profile E-mail WWW  
 
 Post subject:
PostPosted: Tue Mar 04, 2008 10:44 am 
Offline
Moderator
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Wed Jul 02, 2003 10:13 am
Posts: 7493
Location: Milan
Country: Italy (it)
[Topic moved from Navision DOS forum to Navision Tips & Tricks forum]

_________________
Regards,Alain Krikilion
Use the SEARCH,Luke! || No PM,please use the forum. || May the <SOLVED>-attribute be in your title! || Read Forum Rules before making a posting


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 04, 2008 4:47 pm 
Offline

Joined: Wed Jan 14, 2004 8:45 pm
Posts: 238
Location: Canada
Country: Canada (ca)
Thanks - but I do not see 'Navision Communication Component version 2' as one of the automation variables available to me.

Where do I go to add it - is there a dll somewhere I can download?

Thanks,

-a


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 04, 2008 5:07 pm 
Offline
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Thu Oct 16, 2003 8:50 am
Posts: 12265
Location: Brno
Country: Czech Republic (cz)
They are part of NAV Client installation, but are not included in the standard installation type. You need to run NAV install again and add the component "Commerce integration" or how it is named. After that, you will have these components available.

_________________
Kamil Sacek
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.


Top
 Profile E-mail WWW  
 
 Post subject:
PostPosted: Tue Mar 04, 2008 5:34 pm 
Offline

Joined: Wed Jan 14, 2004 8:45 pm
Posts: 238
Location: Canada
Country: Canada (ca)
Hi,

Thanks, I just pulled these two dlls from the CD and registered them:
NSComCom2.dll
SocketBusAdapter.dll

Can you verify that the syntax of the IP address would be something like the below?

I am using 192.168.0.1 & port 52200 as examples, they would end up being parameters. Is the 'Sockets://' text necessary?

OutMsg := CC2.CreateoutMessage('Sockets://192.168.0.1::52200');

Thanks for all your help, this is helping me a lot!

-a


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 04, 2008 7:20 pm 
Offline
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Thu Oct 16, 2003 8:50 am
Posts: 12265
Location: Brno
Country: Czech Republic (cz)
1) Use just one colon between address and port
2) The "sockets" is name of used protocol. (like http, ftp, skype etc.). I do not know, if the components supports another protocol than "tcp/ip sockets".

_________________
Kamil Sacek
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.


Top
 Profile E-mail WWW  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: