public void Init(int udp_port, int local_interq_port, int buffer_size, string cola_entrante, string cola_saliente) { if (iniciado) { return; } //entrante.Name = cola_entrante; //saliente.Name = cola_saliente; localGatewayEndPoint = new IPEndPoint(IPAddress.Any, udp_port); localInterQEndPoint = new IPEndPoint(IPAddress.Any, local_interq_port); if (buffer_size == 0) { buffer_size = 8192; } transporteUDP = new TransporteUDP { TransactionUser = clientTU }; transporteUDP.AbrirTransporte(localGatewayEndPoint, buffer_size, "main_server"); T.TRACE("COMM: transporte UDP iniciado."); //FileServer.MessageReceived += FileServer_MessageReceived; //fileServer = new FileServer(localInterQEndPoint); iniciado = true; T.TRACE("COMM: Cliente Windows Mobile iniciado."); clientTU.AutoReportFail += AutoReportFail; clientTU.GeneralFail += GeneralFail; }
private void MainForm_Load(object sender, EventArgs e) { int port = Convert.ToInt32(ConfigurationManager.AppSettings["port"]); openFileDialog1.InitialDirectory = ConfigurationManager.AppSettings["firmware_path"]; firmwareBinaryFilename = ConfigurationManager.AppSettings["fota_filename"]; int tcp_timer_tr = Convert.ToInt32(ConfigurationManager.AppSettings["tcp_timer_tr"]); int tcp_timer_trm = Convert.ToInt32(ConfigurationManager.AppSettings["tcp_timer_trm"]); int tcp_timer_tv = Convert.ToInt32(ConfigurationManager.AppSettings["tcp_timer_tv"]); int udp_timer_tr = Convert.ToInt32(ConfigurationManager.AppSettings["udp_timer_tr"]); int udp_timer_trm = Convert.ToInt32(ConfigurationManager.AppSettings["udp_timer_trm"]); int udp_timer_tv = Convert.ToInt32(ConfigurationManager.AppSettings["udp_timer_tv"]); int queue_delay = Convert.ToInt32(ConfigurationManager.AppSettings["queue_delay"]); var listener = new IPEndPoint(IPAddress.Any, port); // aca queda corriendo en background transporteUDP = new TransporteUDP(); ut = new TesterUT { FotaQueueDelay = queue_delay }; Devices.i().RetrieveDevices += MainForm_UpdateDevices; if (udp_timer_tr != 0) { transporteUDP.TimerTR = udp_timer_tr; } if (udp_timer_trm != 0) { transporteUDP.TimerTRM = udp_timer_trm; } if (udp_timer_tv != 0) { transporteUDP.TimerTV = udp_timer_tv; } transporteUDP.UsuarioTransaccion = ut; transporteUDP.AbrirTransporte(listener, 8192, "main_server"); SA.Colas.Colas.i().DefaultUserGroup = "Usuarios"; transporteTCP = new TransporteTCP(); if (tcp_timer_tr != 0) { transporteTCP.TimerTR = tcp_timer_tr; } if (tcp_timer_trm != 0) { transporteTCP.TimerTRM = tcp_timer_trm; } if (tcp_timer_tv != 0) { transporteTCP.TimerTV = tcp_timer_tv; } transporteTCP.UsuarioTransaccion = ut; transporteTCP.AbrirTransporte(listener, 8192, "main_server"); }