//Funkcja do wysyłania wiadomości po nacisnięciu public void SendCallRequest(string sourcename, string destname, string demandedCapacity) { try { NewLog($"CPCC: Send Call Request to NCC: Src: {sourcename} Dest: {destname} Capacity: {demandedCapacity}", myWindow, "LimeGreen"); string message = null; message = MessageNames.CALL_REQUEST + " " + sourcename + " " + destname + " " + demandedCapacity + " "; byte[] messagebyte = new byte[message.Length]; messagebyte = Encoding.ASCII.GetBytes(message); //Wyslłanie wiadomości UDP UdpClient client = new UdpClient(NCCIpAddress.ToString(), 11000); client.Send(messagebyte, messagebyte.Length); } catch (Exception e) { e.ToString(); } }
//public void SendMessage() //{ // NewLog($"sacfewdc", window, "Pink"); // MyPacket packet = new MyPacket(); // packet.Port = 111; // //packet.Port = 111; // //packet.DestinationAddress = IPAddress.Parse("127.0.0.30"); // NewLog($"iudhkiuagf", window, "Pink"); // mySocket.Send(packet); // NewLog($"2378273", window, "Pink"); // NewLog($"Wysłano pakiet nr {packet.ID} wiadomość {packet.Payload} z portu {packet.Port}", window, "Pink"); // //await Task.Delay(TimeSpan.FromMilliseconds(10000)); //} public void SendCallConfirmed(string accept, string source, string destination, string demanded, string ncc_source) { try { string message = null; message = accept + " " + source + " " + destination + " " + demanded + " " + ncc_source; NewLog($"CPCC: Send CallConfirmed message to NCC", myWindow, "AntiqueWhite"); string message2 = null; message2 = MessageNames.CALL_CONFIRMED_FROM_CPCC + " " + message; byte[] messagebyte = new byte[message2.Length]; messagebyte = Encoding.ASCII.GetBytes(message2); //Wyslłanie wiadomości UDP UdpClient client = new UdpClient(); client.Send(messagebyte, messagebyte.Length, NCCIpAddress.ToString(), 11000); } catch { } }