Exemplo n.º 1
0
        private void SendData()
        {
            Console.WriteLine("DataSender::SendData ENTER");
            Guid Tier0TestGuid = new Guid("e04ffdc1-637d-4640-bfe6-55fa5a38a178");

            transportLayerCommunicator.register(Tier0TestGuid, this);
            //String strIP = "127.0.0.1";
            //byte[] byteIP = System.Text.Encoding.ASCII.GetBytes(strIP);
            String strMsg = "Hi da";

            byte[] msg = System.Text.Encoding.ASCII.GetBytes(strMsg);
            //byte[] byteIP = {127, 0, 0, 1};
            //byte[] byteIP = {10, 200, 76, 45};
            byte[]    byteIP = { 192, 168, 1, 100 };
            IPAddress IP     = new IPAddress(byteIP);

            IPAddress IP1 = Tashjik.Common.UtilityMethod.GetLocalHostIP();

            Console.WriteLine(IP1.ToString());


            //TransportLayerCommunicator.Msg msg = new TransportLayerCommunicator.Msg(Tier0TestGuid);

            //MemoryStream data = new MemoryStream(Marshal.SizeOf(Tier0TestGuid));
            //msg.setData(data);

            Thread.Sleep(1000);

            transportLayerCommunicator.BeginTransportLayerSendOneWay(IP, msg, 0, strMsg.Length, Tier0TestGuid, new AsyncCallback(sendDataCallBack), IP);

            //sendSameDataToSameIP_MultipleTimes(IP, msg, 0, strMsg.Length, Tier0TestGuid, null, null);


            Console.WriteLine("DataSender::SendData EXIT");
        }
Exemplo n.º 2
0
        private void requestBootStrapNode()
        {
            Console.WriteLine("Entering requestBootStrapNode");
#if SIM
            transportLayerCommunicator.register(ClientGuid, this);
            byte[]    byteIP    = { 127, 0, 0, 1 };
            IPAddress ipAddress = new IPAddress(byteIP);

            String strMsg = "bootStrap request";
            byte[] msg    = System.Text.Encoding.ASCII.GetBytes(strMsg);
            transportLayerCommunicator.BeginTransportLayerSendOneWay(ipAddress, msg, 0, strMsg.Length, ClientGuid, new AsyncCallback(sendDataCallBack), ipAddress);
#else
            chordInstanceGuid = new Guid("");
            return(null);
#endif
        }