private void Initialize(ITcpAdapter tcpClient = null) { _data = ""; _commandIndex = -1; _commands = new List <ISymCommand>(); _client = tcpClient; _keepAliveThread = null; _keepAliveActive = false; Server = ""; _lastError = ""; }
/// <summary> /// Responsável pela tentativa de Conexão do Componente MultiAccessClient /// disparando evento AoFalharConexaoNoServidor em caso de falha de conexão /// </summary> public virtual void Conectar() { if (OidCronograma != null && Login != null) { try { if (tcpAdapter == null || (tcpAdapter != null && !tcpAdapter.Conectado)) { tcpAdapter = TcpAdapterFactory(); //tentativa de conexão no ip e porta predefinidos tcpAdapter.Conectar(EnderecoIp, Porta); Conectado = true; autenticado = true; threadComunicaoServidor = new Thread(RnProcessarEventos) { IsBackground = true, Priority = ThreadPriority.Normal, Name = string.Format("Client#{0}", Login) }; threadComunicaoServidor.Start(); } else { return; } RnEnviarMensagemIdentificao(); } catch (Exception excessao) { // verifica instância do tcpCliente tal como se está conectado AcionarEventoAoFalharConexao(); Debug.WriteLine(string.Format("AccessClient({2})Mensagem:{0}\nCallStack{1}", excessao.Message, excessao.StackTrace, Login), "JsonConvert:"); DispararExcessao(excessao); } } else { MessageBox.Show("Deve se preencher as Propriedades CronogramaId e o Login do MultiAccessClient"); } }
public SymSocket(ITcpAdapter tcpClient, string server, int port) { Initialize(tcpClient); Server = server; Port = port; }
public SymSocket(ITcpAdapter tcpClient) { Initialize(tcpClient); }
private void Initialize(ITcpAdapter tcpClient = null) { _data = ""; _commandIndex = -1; _commands = new List<ISymCommand>(); _client = tcpClient; _keepAliveThread = null; _keepAliveActive = false; Server = ""; _lastError = ""; }
public SymSocket(ITcpAdapter tcpClient, string server, int port) { Initialize(tcpClient); Server = server; Port = port; }
public SymSocket(ITcpAdapter tcpClient) { Initialize(tcpClient); }
/// <summary> /// Retornar o cast para stub /// </summary> /// <param name="adapter"></param> /// <returns></returns> private TcpAdapterStub ConverterParaTcpAdapterStub(ITcpAdapter adapter) { return(adapter as TcpAdapterStub); }