Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Internet (https://www.clubdelphi.com/foros/forumdisplay.php?f=3)
-   -   Indy UDP Server - Ayuda (https://www.clubdelphi.com/foros/showthread.php?t=86231)

kaiserilich 03-07-2014 20:44:06

Indy UDP Server - Ayuda
 
hola,

tengo una chat que hice con Delphi 6 y la version que trae de Indy.. pero ahora al abrirlo con XE5 me falla por unos cambios en la version del Server...

antes la function de lectura recibia un TStream y asi lo procesaba para obtener el mensaje recibido...

Código:


procedure TForm1.udp_srvUDPRead(Sender: TObject; AData: TStream; ABinding: TIdSocketHandle);
....
    DataStringStream.CopyFrom(AData, AData.Size);

ahora lo hacen de esta manera

Código:


procedure TForm1.udp_srvUDPRead(AThread: TIdUDPListenerThread; const AData: TIdBytes; ABinding: TIdSocketHandle);

y no se como sacar el mensaje recibio, alguno podria echarme un cable..

gracias

dec 03-07-2014 21:03:45

Hola,

Según Remy Lebeau existe una función "BytesToString" en la unidad "idGlobal.pas" de Indy. Echa un vistazo a ver si te sirve. ;)

kaiserilich 03-07-2014 21:12:36

ya esta solucionado, gracias :-)

tenia que sustituir DataStringStream.CopyFrom(AData, AData.Size); por DataStringStream.WriteData(AData, Length(AData));

dec 03-07-2014 21:42:21

Bien está saberlo. :)


La franja horaria es GMT +2. Ahora son las 20:01:17.

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