This is the last fraction of Navision TCP/IP listener component which I ever mentioned in previous article. You can use this connector to communicate with Navision listener for many advantages. To inline with the overall project integration, I want this connector component to assist creating Navision service on top of WCF technology. The result of this component would be just an assembly that provide encapsulation of the detail communication between the client and the Navision listener. I am developing this component using Microsoft Visual C# 2008 Express editions.

Interface Class

This component has simple interface class with few methods. The design of this interface class must comply with one way direction and two way directions of communications. With variance of whether the message is in string format or byte of array, I could define the interface like below:

  • SetTimeOut method to determine the timeout of the communication.
  • SetEncoding method to set text encoding upon transmitting the message.
  • Request overload method, Send one way direction communication which one send string message and the other one send array of binary message.
  • RequestResponse overload method, similar like above but these methods are for two way direction of communication.


NavCommand Class

Like in server listener component, I need to have “NavCommand” class that contain exactly same communication protocols and constants values.


NavServerConnector Class

I need this class to implement the class interface above. Like in server listener component, this component will be using “TCPClient” class inside “System.Net.Sockets” assembly. In overview this class would be like following:


Class Constructor & privates methods

I have simple constructor and some generic methods to minimize repeated codes as follow:

  • The constructor has minimum effort to nullify the client private variable class
  • “SendCommand” method is generic function to send protocol command message
  • “SendData” method is generic function to send data in array of bytes
  • “ReceiveData” method is generic function to receive data from TCP listener.
  • “NavAcknowledge” method is generic function to receive and check the response command of “AcknowledgeOK” from TCP listener.
  • “ReadNavReplyCommand” method is generic function to receive reply command from TCP listener.

Constructor And Private Methods

SetTimeout & SetEncoding Methods

This implementation is simply just assigned the value into private variable class.

SetTimeout and SetEncoding

Request Method

In this method, I write the codes of one way communication protocols that comply with listener server component.

Request Method

RequestResponse method

Similar like above method, this method will require constructing two ways communication protocols that comply with listener server component. The only different is the additional cycle 4 and 5 which suppose to handle the response message.



If you have notice the client TCP component is much less complex than the server listener. The key objective of this component is to encapsulate the detail communication with Navision server listener. Thus, the client component has no interaction with Navision domain; therefore I can use this component in any physical PC even remotely. At this moment, I have done addressing the communication tunnel with Navision via TCP protocols. These give us possibilities for external system communicates with Navision business process. The Navision message type designer will address the business logic processing and next target is to build the factory message library in .net component.

I hope this article is helpful and give added value to your knowledge and extend another possibility that you can do in Navision. Though right now I am using Navision 4.0 version, it is mostly possible to implement this component in higher version even Navision 2009 where the component will sit on the middle tier.  There is so much excitement and opportunities you can have with TCP listener and I do hope you are having fun with it. Thank you for your time.

Leave a Reply

To prove you're a person (not a spam script), type the security text shown in the picture. Click here to regenerate some new text.
Click to hear an audio file of the anti-spam word