コード例 #1
0
        static void Main()
        {
            //Create NGRIDClient object to connect to NGRID
            //Name of this application: ProducerSample
            var ngridClient = new NGRIDClient("ProducerSample");

            //Connect to NGRID server
            ngridClient.Connect();

            Console.WriteLine("Enter text to be sent to consumer sample.");

            while (true)
            {
                //Get a message from user
                var messageText = Console.ReadLine();
                if (string.IsNullOrEmpty(messageText) || messageText == "exit")
                {
                    break;
                }

                //Create a NGRID Message to send to ConsumerSample
                var message = ngridClient.CreateMessage();
                //Set destination application name
                message.DestinationApplicationName = "ConsumerSample";
                //message.DestinationServerName = "someserver";
                //Set message data
                message.MessageData = Encoding.UTF8.GetBytes(messageText);

                //Send message
                message.Send();
            }

            //Disconnect from NGRID server
            ngridClient.Disconnect();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: erisonliang/NGRID
        static void Main(string[] args)
        {
            //Create NGRIDClient object to connect to NGRID
            //Name of this application: ConsumerSample
            var ngridClient = new NGRIDClient("ConsumerSample");

            //Register to MessageReceived event to get messages.
            ngridClient.MessageReceived += NGRIDClient_MessageReceived;

            //Connect to NGRID server
            ngridClient.Connect();

            //Wait user to press enter to terminate application
            Console.WriteLine("hit enter to quit...");
            Console.ReadLine();

            //Disconnect from NGRID server
            ngridClient.Disconnect();
        }
コード例 #3
0
 /// <summary>
 /// Creates a new NGRIDServiceApplication object.
 /// </summary>
 /// <param name="applicationName">Name of the application</param>
 /// <param name="ipAddress">IP address of NGRID server</param>
 /// <param name="port">TCP port of NGRID server</param>
 public NGRIDServiceConsumer(string applicationName, string ipAddress, int port) 
 {
     NgridClient = new NGRIDClient(applicationName, ipAddress, port);
 }
コード例 #4
0
 /// <summary>
 /// Creates a new NGRIDServiceApplication object with default port to connect to NGRID server.
 /// </summary>
 /// <param name="applicationName">Name of the application</param>
 /// <param name="ipAddress">IP address of NGRID server</param>
 public NGRIDServiceConsumer(string applicationName, string ipAddress)
 {
     NgridClient = new NGRIDClient(applicationName, ipAddress, CommunicationConsts.DefaultNGRIDPort);
 }
コード例 #5
0
 /// <summary>
 /// Creates a new NGRIDServiceApplication object with default values to connect to NGRID server.
 /// </summary>
 /// <param name="applicationName">Name of the application</param>
 public NGRIDServiceConsumer(string applicationName)
 {
     NgridClient = new NGRIDClient(applicationName, CommunicationConsts.DefaultIpAddress, CommunicationConsts.DefaultNGRIDPort);
     Initialize();
 }
コード例 #6
0
 /// <summary>
 /// Creates a new NGRIDServiceApplication object.
 /// </summary>
 /// <param name="applicationName">Name of the application</param>
 /// <param name="ipAddress">IP address of NGRID server</param>
 /// <param name="port">TCP port of NGRID server</param>
 public NGRIDServiceConsumer(string applicationName, string ipAddress, int port)
 {
     NgridClient = new NGRIDClient(applicationName, ipAddress, port);
 }
コード例 #7
0
 /// <summary>
 /// Creates a new NGRIDServiceApplication object with default port to connect to NGRID server.
 /// </summary>
 /// <param name="applicationName">Name of the application</param>
 /// <param name="ipAddress">IP address of NGRID server</param>
 public NGRIDServiceConsumer(string applicationName, string ipAddress)
 {
     NgridClient = new NGRIDClient(applicationName, ipAddress, CommunicationConsts.DefaultNGRIDPort);
 }
コード例 #8
0
 /// <summary>
 /// Creates a new NGRIDServiceApplication object with default values to connect to NGRID server.
 /// </summary>
 /// <param name="applicationName">Name of the application</param>
 public NGRIDServiceConsumer(string applicationName)
 {
     NgridClient = new NGRIDClient(applicationName, CommunicationConsts.DefaultIpAddress, CommunicationConsts.DefaultNGRIDPort);
     Initialize();
 }
コード例 #9
0
 /// <summary>
 /// Creates a new NGRIDServiceApplication object.
 /// </summary>
 /// <param name="applicationName">Name of the application</param>
 /// <param name="ipAddress">IP address of NGRID server</param>
 /// <param name="port">TCP port of NGRID server</param>
 public NGRIDServiceApplication(string applicationName, string ipAddress, int port) 
 {
     _ngridClient = new NGRIDClient(applicationName, ipAddress, port);
     Initialize();
 }
コード例 #10
0
 /// <summary>
 /// Creates a new NGRIDServiceApplication object with default port to connect to NGRID server.
 /// </summary>
 /// <param name="applicationName">Name of the application</param>
 /// <param name="ipAddress">IP address of NGRID server</param>
 public NGRIDServiceApplication(string applicationName, string ipAddress)
 {
     _ngridClient = new NGRIDClient(applicationName, ipAddress, CommunicationConsts.DefaultNGRIDPort);
     Initialize();
 }
コード例 #11
0
 /// <summary>
 /// Creates a new NGRIDServiceApplication object.
 /// </summary>
 /// <param name="applicationName">Name of the application</param>
 /// <param name="ipAddress">IP address of NGRID server</param>
 /// <param name="port">TCP port of NGRID server</param>
 public NGRIDServiceApplication(string applicationName, string ipAddress, int port)
 {
     _ngridClient = new NGRIDClient(applicationName, ipAddress, port);
     Initialize();
 }
コード例 #12
0
 /// <summary>
 /// Creates a new NGRIDServiceApplication object with default port to connect to NGRID server.
 /// </summary>
 /// <param name="applicationName">Name of the application</param>
 /// <param name="ipAddress">IP address of NGRID server</param>
 public NGRIDServiceApplication(string applicationName, string ipAddress)
 {
     _ngridClient = new NGRIDClient(applicationName, ipAddress, CommunicationConsts.DefaultNGRIDPort);
     Initialize();
 }