예제 #1
0
        public void Start()
        {
            ConnectToCableClaud();
            while (true)
            {
                try
                {
                    var message = Receive(CSocket);
                    switch (message)
                    {
                    case "OK":
                        ManagementAgent.ReturnLog("Sent message.");
                        break;

                    case "NOTOK":
                        ManagementAgent.ReturnLog("Unable to send message.");
                        break;

                    default:
                        byte[]     msg  = Encoding.Default.GetBytes(message);
                        MPLSPacket mpls = new MPLSPacket(msg);
                        ManagementAgent.ReturnLog($"Port: {PortNumber}; Received MPLS Packet: " + mpls.MPLSInfo());
                        SwitchingFabric.SwapLabels(PortNumber, mpls);
                        break;
                    }
                }
                catch (Exception e)
                {
                }
            }
        }
예제 #2
0
 public void Send(MPLSPacket mplsp)
 {
     byte[] byteData = mplsp.GetBytes();
     CSocket.BeginSend(byteData, 0, byteData.Length, 0,
                       new AsyncCallback(SendCallback), CSocket);
     ManagementAgent.ReturnLog($"Port {PortNumber} Trying to send MPLS Packet: " + mplsp.MPLSInfo());
 }