void OnGUI() { if (GUILayout.Button("Sent")) { var package = new PingPongPackage(UDPBoxUtility.DefaultHeadBytes); mUDPBoxBroadcast.StartBroadcast(package.Serialize()); } }
public void Initialization(string packageHead, bool useInternalBroadcastLogic) { mUseInternalBroadcastLogic = useInternalBroadcastLogic; var udpClientArray = new UDPBox_UDPClient[UdpBoxEndPort - UdpBoxBeginPort]; for (int i = 0, port = UdpBoxBeginPort; port < UdpBoxEndPort; i++, port++) { udpClientArray[i] = UDPBoxFactory.GeterateUdpClient(port); } UDPBox.Initialization(udpClientArray, packageHead); mEstablishConnectPackage = new EstablishConnectPackage(PackageHeadBytes); mPingPongPackageTemplate = new PingPongPackage(PackageHeadBytes); SelfIPAddress = SelfIPAddress ?? UDPBoxUtility.GetSelfIP(BroadcastNetPrefixIP); }
public PingPongHandler(byte[] packageHead) { mTemplate = new PingPongPackage(packageHead); }