Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Internet
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Colaboración Paypal con ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 27-07-2010
Avatar de richy08
richy08 richy08 is offline
Miembro
 
Registrado: may 2007
Ubicación: Bucerias, Nayarit Mexico
Posts: 529
Poder: 20
richy08 Va por buen camino
sabes creo que mas bien el problema radica en este pedazo de codigo que corre en el cliente

Código Delphi [-]
procedure TClientHandleThread.Execute;
begin
  while not Terminated do
  begin
    if not Frm_Posgue.Client.Connected then
      Terminate
    else
    try
      Frm_Posgue.Client.ReadBuffer(CB, SizeOf (CB));
      Synchronize(HandleInput);
    except
    end;
  end;
end;

ya que al llegar a esta linea Frm_Posgue.Client.ReadBuffer(CB, SizeOf (CB)); por alguna razon no manda llamar el Synchronize alguna pista de que pueda ser gracias por cualquier comentario
Responder Con Cita
  #2  
Antiguo 27-07-2010
Avatar de richy08
richy08 richy08 is offline
Miembro
 
Registrado: may 2007
Ubicación: Bucerias, Nayarit Mexico
Posts: 529
Poder: 20
richy08 Va por buen camino
bueno por fin encontre mi problema jeje al parecer la forma en que creo los componentes no es la adecuada seguire investigando
Responder Con Cita
  #3  
Antiguo 28-07-2010
manuc manuc is offline
Miembro
 
Registrado: abr 2010
Posts: 165
Poder: 17
manuc Va por buen camino
Hola Richy08,

La verdad es que no lo entendí muy bien, pero me alegro que hayas encontrado la solución.

Un saludo.
Responder Con Cita
  #4  
Antiguo 28-07-2010
Avatar de richy08
richy08 richy08 is offline
Miembro
 
Registrado: may 2007
Ubicación: Bucerias, Nayarit Mexico
Posts: 529
Poder: 20
richy08 Va por buen camino
Buenas tardes manuc he estado reajustando el codigo con los ejemplos que me has dado pero me saltan algunos errores que no he conseguido resolverlos

1. el primero es al crear la clase en la linea de destructor Destroy;
Código Delphi [-]
tmisComponentes=Class(tPersistent)
  private
   fConexionADO:TADOConnection;
   fQueryADO:TAdoQuery;
   fConexionZ:TZConnection;
   fQueryZ:TZQuery;
  Public  
   destructor Destroy; 
   property Conexion:TADOConnection read fConexionADO write fConexionADO;
   property Query:TAdoQuery read fQueryADO write fQueryADO;
   property Conexion1:TZConnection read fConexionZ write fConexionZ;
   property Query1:TZQuery read fQueryZ write fQueryZ;
  end;
[Error] Interfaces.pas(47): Unsatisfied forward or external declaration: 'tmisComponentes.Destroy', al comentarla el programa corre pero no se s iesto me desencadena algunos otros errores


2.-al querer asignarle al componente "conexion" la cadena de conexion que fue creada en el evento formcreate

Código Delphi [-]
procedure TFrm_Interfaces.FormCreate(Sender: TObject);
begin
  Clients := TThreadList.Create;
   cadena:='Provider=SQLOLEDB.1;Password=Siti2009;Persist Security Info=True;User ID=sa;Initial Catalog=PMS;Data Source=SITISERVER08\SITISQL_05; ';
  cadena:=cadena+' Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=DESARROLLO;Use Encryption for Data=False;Tag with column collation when possible=False';
  CBServerActive.Checked:=true;
end;


al querer asignarle la cadena en el evento serverexecute MisComponentes.Conexion.ConnectionString:=cadena;


Código Delphi [-]
procedure TFrm_Interfaces.ServerExecute(AThread: TIdPeerThread);
var
  ActClient, RecClient: PClient;                                                                              
  CommBlock, NewCommBlock: TCommBlock;
  RecThread: TIdPeerThread;
  i, seleccion: Integer;
  MisComponentes:tmisComponentes;
begin
  if not AThread.Terminated and AThread.Connection.Connected then
  begin
    AThread.Connection.ReadBuffer (CommBlock, SizeOf (CommBlock));
    ActClient := PClient(AThread.Data);
    ActClient.LastAction := Now;  // update the time of last action
    MisComponentes :=  tmisComponentes(AThread.Data);
    //conneccionMSSQL
    MisComponentes.Conexion.ConnectionString:=cadena;
    MisComponentes.Conexion.loginprompt:=false;
    MisComponentes.Conexion.provider:='SQLOLEDB.1';
    MisComponentes.Conexion.connected;
    //conneccionMSSQL
    //conneccionMysql
    MisComponentes.Conexion1.Catalog:= 'lookup';
    MisComponentes.Conexion1.Database:= 'cdr';
    MisComponentes.Conexion1.HostName:= '192.168.10.3';
    MisComponentes.Conexion1.Password:= 'siti270';
    MisComponentes.Conexion1.Protocol:= 'mysql-5';
    MisComponentes.Conexion1.port:= 3306;
    MisComponentes.Conexion1.User:= 'root';
    MisComponentes.Conexion1.connect; 
    //conneccionMysql
    //queryMssql
    MisComponentes.Query.Close;
    MisComponentes.Query.Connection:= MisComponentes.Conexion;
    MisComponentes.Query.SQL.Text:='select idext, DesTel from pbx_ext where acode=:acode';
    MisComponentes.Query.parameters.ParamByName('acode').Value:=CommBlock.acode;
    MisComponentes.Query.cursorType := ctStatic;
    MisComponentes.Query.open;
    //queryMssql
    //queryMysql
     MisComponentes.Query1.Connection:=MisComponentes.Conexion1;
     MisComponentes.Query1.SQL.Text:='update lookup set  allowcalls=:allowcalls, ldesc=:ldesc where code=:code ';
    //queryMysql

    //ejecuta abrir y cerrar lineas
     i:=0;
     seleccion:=Query.RecordCount;
     MisComponentes.Query.First;
     While ido
     begin
        MisComponentes.Query1.Close;
        MisComponentes.Query1.ParamByName('allowcalls').Value:=CommBlock.estado;
        MisComponentes.Query1.ParamByName('ldesc').Value:=CommBlock.nombre;
        MisComponentes.Query1.ParamByName('code').Value:=MisComponentes.Query1.fieldbyname('idext').Value;
        MisComponentes.Query1.ExecSQL;
        i:=i+1;
        MisComponentes.Query.Next;
     end;
    //ejecuta abrir y cerrar lineas
    Protocol.Lines.Add (TimeToStr(Time)+' The process for '+CommBlock.MyUserName+' was done ');// # Confirm'+inttostr(CommBlock.nconf));
    NewCommBlock.Command := 'DIALOG';       // the message should popup on the client's screen
    NewCommBlock.MyUserName := '[PBX Server]';  // the server's username
    NewCommBlock.Msg := 'The process was done  ';  // the message to show
    NewCommBlock.ReceiverName := '[return-to-sender]'; // unnecessary
    AThread.Connection.WriteBuffer (NewCommBlock, SizeOf (NewCommBlock), true);  // and there it goes...
  end;
end;

el error que envia es Project interfacesP.exe raised exception class EAccessViolation with message 'Access violation at address 00000000. Read of address 00000000'. Process stopped. Use Step or Run to continue.

alguna idea de que pueda ser mil gracias
Responder Con Cita
  #5  
Antiguo 28-07-2010
manuc manuc is offline
Miembro
 
Registrado: abr 2010
Posts: 165
Poder: 17
manuc Va por buen camino
Hola Richy08,

Código Delphi [-]
[Error] Interfaces.pas(47): Unsatisfied forward or external declaration: 'tmisComponentes.Destroy'

No estoy seguro, pero ¿puede ser que te falte la implementación de este procedimiento?

Después en estas líneas de código:
Código Delphi [-]
 ActClient := PClient(AThread.Data);
 ActClient.LastAction := Now;  // update the time of last action
 MisComponentes :=  tmisComponentes(AThread.Data);

En "AThread.Data" ¿que almacenas la estructura de tipo "PClient" y de tipo "tmisComponentes"?

Por otro lado, si puedieras hacer un seguimiento a la ejecución del código e indicarme la línea más o menos donde te da el error, te podría dar alguna sugerencia.

No obstante revisaré el código que has puesto a ver si veo algo raro.

Un saludo.
Responder Con Cita
  #6  
Antiguo 28-07-2010
Avatar de richy08
richy08 richy08 is offline
Miembro
 
Registrado: may 2007
Ubicación: Bucerias, Nayarit Mexico
Posts: 529
Poder: 20
richy08 Va por buen camino
Cita:
Empezado por manuc Ver Mensaje
Hola Richy08,
Código Delphi [-]
[Error] Interfaces.pas(47): Unsatisfied forward or external declaration: 'tmisComponentes.Destroy'



No estoy seguro, pero ¿puede ser que te falte la implementación de este procedimiento?
a ok si me imaginaba algo asi, sabes estoy un poco enredado es la primera ves que me veo en la necesidad de usar clases que yo mismo creo, me imagino que en esta parte es donde le doy .free a los querys que creo para que liberen dicha memoria??

Cita:
Empezado por manuc Ver Mensaje
Después en estas líneas de código:

Código Delphi [-]
ActClient := PClient(AThread.Data);
ActClient.LastAction := Now; // update the time of last action
MisComponentes := tmisComponentes(AThread.Data);





En "AThread.Data" ¿que almacenas la estructura de tipo "PClient" y de tipo "tmisComponentes"?
asi es en AThread.Data almaceno los datos de esas dos estructuras.

Cita:
Empezado por manuc Ver Mensaje

Por otro lado, si puedieras hacer un seguimiento a la ejecución del código e indicarme la línea más o menos donde te da el error, te podría dar alguna sugerencia.

No obstante revisaré el código que has puesto a ver si veo algo raro.

Un saludo.
ya he corrido paso a paso el codigo y en la linea que me salta el error es

MisComponentes.Conexion.ConnectionString:=cadena;

Código Delphi [-]
procedure TFrm_Interfaces.ServerExecute(AThread: TIdPeerThread);
var
  ActClient, RecClient: PClient;                                                                              
  CommBlock, NewCommBlock: TCommBlock;
  RecThread: TIdPeerThread;
  i, seleccion: Integer;
  MisComponentes:tmisComponentes;
begin
  if not AThread.Terminated and AThread.Connection.Connected then
  begin
    AThread.Connection.ReadBuffer (CommBlock, SizeOf (CommBlock));
    ActClient := PClient(AThread.Data);
    ActClient.LastAction := Now;  // update the time of last action
    MisComponentes :=  tmisComponentes(AThread.Data);
    //conneccionMSSQL
    MisComponentes.Conexion.ConnectionString:=cadena; //aqui es donde truena
    MisComponentes.Conexion.loginprompt:=false;
    MisComponentes.Conexion.provider:='SQLOLEDB.1';
    MisComponentes.Conexion.connected;
    //conneccionMSSQL
    //conneccionMysql
    MisComponentes.Conexion1.Catalog:= 'lookup';
    MisComponentes.Conexion1.Database:= 'cdr';
    MisComponentes.Conexion1.HostName:= '192.168.10.3';
    MisComponentes.Conexion1.Password:= 'siti270';
    MisComponentes.Conexion1.Protocol:= 'mysql-5';
    MisComponentes.Conexion1.port:= 3306;
    MisComponentes.Conexion1.User:= 'root';
    MisComponentes.Conexion1.connect; 
    //conneccionMysql
 
    //queryMssql
    MisComponentes.Query.Close;
    MisComponentes.Query.Connection:= MisComponentes.Conexion;
    MisComponentes.Query.SQL.Text:='select idext, DesTel from pbx_ext where acode=:acode';
    MisComponentes.Query.parameters.ParamByName('acode').Value:=CommBlock.acode;
    MisComponentes.Query.cursorType := ctStatic;
    MisComponentes.Query.open;
    //queryMssql
    //queryMysql
     MisComponentes.Query1.Connection:=MisComponentes.Conexion1;
     MisComponentes.Query1.SQL.Text:='update lookup set  allowcalls=:allowcalls, ldesc=:ldesc where code=:code ';
    //queryMysql

    //ejecuta abrir y cerrar lineas
     i:=0;
     seleccion:=Query.RecordCount;
     MisComponentes.Query.First;
     While ido
     begin
        MisComponentes.Query1.Close;
        MisComponentes.Query1.ParamByName('allowcalls').Value:=CommBlock.estado;
        MisComponentes.Query1.ParamByName('ldesc').Value:=CommBlock.nombre;
        MisComponentes.Query1.ParamByName('code').Value:=MisComponentes.Query1.fieldbyname('idext').Value;
        MisComponentes.Query1.ExecSQL;
        i:=i+1;
        MisComponentes.Query.Next;
     end;
    //ejecuta abrir y cerrar lineas
    Protocol.Lines.Add (TimeToStr(Time)+' The process for '+CommBlock.MyUserName+' was done ');// # Confirm'+inttostr(CommBlock.nconf));
    NewCommBlock.Command := 'DIALOG';       // the message should popup on the client's screen
    NewCommBlock.MyUserName := '[PBX Server]';  // the server's username
    NewCommBlock.Msg := 'The process was done  ';  // the message to show
    NewCommBlock.ReceiverName := '[return-to-sender]'; // unnecessary
    AThread.Connection.WriteBuffer (NewCommBlock, SizeOf (NewCommBlock), true);  // and there it goes...
  end;
end;

gracias por tus respuestas
Responder Con Cita
  #7  
Antiguo 28-07-2010
manuc manuc is offline
Miembro
 
Registrado: abr 2010
Posts: 165
Poder: 17
manuc Va por buen camino
Hola nuevamente,

Me podrías poner el código del evento onConnect del TCPServer?

gracias.
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Como instalar los componenetes de la Norma 19 diego11 Varios 3 17-10-2007 12:08:44
componenetes en un TTabControl lucasarts_18 OOP 2 27-09-2005 23:44:43
instalar nuevos componenetes aranel OOP 6 02-08-2005 09:25:33
Multiple Hilos con Indy en Delphi 6 cancerbero Varios 4 12-06-2004 19:01:21
Componenetes para envio y recepcion de mensajes en la red enrique800 OOP 3 29-01-2004 04:31:41


La franja horaria es GMT +2. Ahora son las 19:38:20.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi