Board index » delphi » UDP

UDP

Hi...Im using a udp server to get data...I open the port and stay listening
with teh ReceiveString(const AmSec) but I receive the data with a lot of
characters..I changed to ReceiveBuffer(var ABuffer; const AByteCount:
Integer; ATimeOut: integer): integer passing a PChar, but when I try to
change pChar to String a receive a memory exception...

Any sugestion???

Im Waiting..

Thanks
Gabriel Moricz
__________________________________________________________________ G@briel
Moricz ICQ#: 4824537 Current ICQ status: + More ways to contact me i See
more about me:
__________________________________________________________________

 

Re:UDP


Hi,

Quote
>Hi...Im using a udp server to get data...I open the port and stay listening
>with teh ReceiveString(const AmSec) but I receive the data with a lot of
>characters..I changed to ReceiveBuffer(var ABuffer; const AByteCount:
>Integer; ATimeOut: integer): integer passing a PChar, but when I try to
>change pChar to String a receive a memory exception...

This is probably because the ReceiveBuffer function is returning in ABuffer
an array of char without the null terminator. Force a null terminator at
memory position (ABuffer + AByteCount + 1) before changing ABuffer to a
Pascal string.

Humberto Jemma (Brazil)

-------------------------------
Message Posted by  <dedGateway>
http://www.dedonline.com/forumb

Re:UDP


Ola Humberto...Obrigado pela resposta...bom...a melhor op??o para buscar
dados em string da rede, na sua opniao, seria o receivebuffer, ou o
receivestring diretamente?

Quote
"Humberto Jemma" <hjamariaje...@yahoo.com.br> wrote in message

news:3d18a2c4_2@dnews...
Quote
> Hi,

> >Hi...Im using a udp server to get data...I open the port and stay
listening
> >with teh ReceiveString(const AmSec) but I receive the data with a lot of
> >characters..I changed to ReceiveBuffer(var ABuffer; const AByteCount:
> >Integer; ATimeOut: integer): integer passing a PChar, but when I try to
> >change pChar to String a receive a memory exception...

> This is probably because the ReceiveBuffer function is returning in
ABuffer
> an array of char without the null terminator. Force a null terminator at
> memory position (ABuffer + AByteCount + 1) before changing ABuffer to a
> Pascal string.

> Humberto Jemma (Brazil)

> -------------------------------
> Message Posted by  <dedGateway>
> http://www.dedonline.com/forumb

Re:UDP


Hi Gabriel,

Let's follow the rules and use English when we post to the ng. If you want
to send me a message in Portuguese, please use my privete e-mail adress.
You are welcome.

Quote
>Ola Humberto...Obrigado pela resposta...bom...a melhor op??o para buscar
>dados em string da rede, na sua opniao, seria o receivebuffer, ou o
>receivestring diretamente?

You ask me if the best option would be using the ReceiveString or the
ReceiveBuffer functions to retreive string data from the network. IMO, if
you know beforehand that the value is a string, using ReceiveString is the
simplest option.

Humberto Jemma (Brazil)

Quote

>> Hi,

>> >Hi...Im using a udp server to get data...I open the port and stay
>listening
>> >with teh ReceiveString(const AmSec) but I receive the data with a lot of
>> >characters..I changed to ReceiveBuffer(var ABuffer; const AByteCount:
>> >Integer; ATimeOut: integer): integer passing a PChar, but when I try to
>> >change pChar to String a receive a memory exception...

>> This is probably because the ReceiveBuffer function is returning in
>ABuffer
>> an array of char without the null terminator. Force a null terminator at
>> memory position (ABuffer + AByteCount + 1) before changing ABuffer to a
>> Pascal string.

>> Humberto Jemma (Brazil)

>> -------------------------------
>> Message Posted by  <dedGateway>
>> http://www.dedonline.com/forumb

-------------------------------
Message Posted by  <dedGateway>
http://www.dedonline.com/forumb

Re:UDP


kudos, Humberto.  very diplomatic.
-pal
Quote
"Humberto Jemma" <hjamariaje...@yahoo.com.br> wrote in message news:3d19cc6e_1@dnews...
> Hi Gabriel,

> Let's follow the rules and use English when we post to the ng. If you want
> to send me a message in Portuguese, please use my privete e-mail adress.
> You are welcome.

> >Ola Humberto...Obrigado pela resposta...bom...a melhor op??o para buscar
> >dados em string da rede, na sua opniao, seria o receivebuffer, ou o
> >receivestring diretamente?

> You ask me if the best option would be

Other Threads