private void threadWait4Clients() { try { CLNBTN_Lg objL_Log = new CLNBTN_Lg(_st_User, _st_FileLog, _bl_OutLineConsole, _bl_OutFileLog, _bl_OutWindow); objL_Log.WriteTextInLog(_st_Relac + " " + _st_RelacSon + " threadWait4Clients. Beginnig PANDORA Server On TCP Port : [" + puerto.ToString() + "] "); Console.WriteLine("Beginnig PANDORA Server On TCP Port : [" + puerto.ToString() + "] "); ipaddress = IPAddress.Parse(direccionIP); tcplistener = new TcpListener(ipaddress, puerto); //tcplistener = new TcpListener(puerto); tcplistener.Start(); // while (conectado) { objL_Log.WriteTextInLog(_st_Relac + " " + _st_RelacSon + " threadWait4Clients. Waiting for Client ..."); Console.WriteLine("Waiting for Client ..."); // socketCliente = tcplistener.AcceptSocket(); // //Entrando un cliente objL_Log.WriteTextInLog(_st_Relac + " " + _st_RelacSon + " threadWait4Clients. Client Connected [" + socketCliente.RemoteEndPoint + "] "); Console.WriteLine("Client Connected [" + socketCliente.RemoteEndPoint + "] "); int llaveCliente = clientesConectados.Count; objL_Log.WriteTextInLog(_st_Relac + " " + _st_RelacSon + " threadWait4Clients. Key for Client [" + llaveCliente.ToString() + "] "); Console.WriteLine("Key for Client [" + llaveCliente.ToString() + "] "); //CLNBTN_FuncKrl o_cliente = new CLNBTN_FuncKrl(this,socketCliente,(clientesConectados.Count)); CLNBTN_FuncKrl o_cliente = new CLNBTN_FuncKrl(_st_Lic, _st_User, _st_FileLog, this, socketCliente, (clientesConectados.Count)); o_cliente.setObjetoParaSalida(this); clientesConectados.Add(o_cliente); clientesConectados[(clientesConectados.Count - 1)].setTimeout(timeout); clientesConectados[(clientesConectados.Count - 1)].start(); // } } catch (System.AccessViolationException ex_0) { CLNBTN_Lg objL_Log = new CLNBTN_Lg(_st_User, _st_FileLog, _bl_OutLineConsole, _bl_OutFileLog, _bl_OutWindow); objL_Log.WriteOutErrorMessage(_st_Relac, _st_RelacSon, "threadWait4Clients. System.AccessViolationException", "", ex_0.Message.ToString()); } catch (Exception ex) { CLNBTN_Lg objL_Log = new CLNBTN_Lg(_st_User, _st_FileLog, _bl_OutLineConsole, _bl_OutFileLog, _bl_OutWindow); objL_Log.WriteOutErrorMessage(_st_Relac, _st_RelacSon, "threadWait4Clients. Exception", "", ex.Message.ToString()); } }
public void Want2Exit(CLNBTN_FuncKrl cliente) { try { cliente.Desconectar(); clientesConectados.Remove(cliente); } catch (System.AccessViolationException ex_0) { CLNBTN_Lg objL_Log = new CLNBTN_Lg(_st_User, _st_FileLog, _bl_OutLineConsole, _bl_OutFileLog, _bl_OutWindow); objL_Log.WriteOutErrorMessage(_st_Relac, _st_RelacSon, "Want2Exit(1). System.AccessViolationException", "", ex_0.Message.ToString()); } catch (Exception ex) { CLNBTN_Lg objL_Log = new CLNBTN_Lg(_st_User, _st_FileLog, _bl_OutLineConsole, _bl_OutFileLog, _bl_OutWindow); objL_Log.WriteOutErrorMessage(_st_Relac, _st_RelacSon, "Want2Exit(1). Exception", "", ex.Message.ToString()); } }