Ver Mensaje Individual
  #2  
Antiguo 22-07-2005
R_Richards R_Richards is offline
Miembro
 
Registrado: feb 2005
Posts: 13
Reputación: 0
R_Richards Va por buen camino
Thumbs up Envio de Mensaje desde el Server al Cliente Indy

Hola Buenas tardes...
Anexo el código en C++ Builder, para hacerlo en Delphi cambia el (->) por (.)

//------------------------------------------------------------------------
bool Enviar_CNT(AnsiString IP,AnsiString Mensaje)
{
bool Envio = false;
int Cont;

TList *Listado = new TList();
Listado = IdTCPServer1->Threads->LockList();
TIdPeerThread* Temp;
try
{
for (Cont = 0; Cont < Listado->Count; Cont++)
{
Temp = (TIdPeerThread*)Listado->Items[Cont];
if (Temp->Connection->Socket->Binding->PeerIP == IP)
{
Temp->Connection->Write(Mensaje);
Envio = true;
break;
}
}
}
__except(1)
{
Temp->Stop();
IdTCPServer1->Threads->UnlockList();
}
IdTCPServer1->Threads->UnlockList();
return Envio;
}
//------------------------------------------------------------------------
Responder Con Cita