udp send byte hatası

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
Cevapla
ufukardal
Üye
Mesajlar: 2
Kayıt: 13 Haz 2022 04:46

udp send byte hatası

Mesaj gönderen ufukardal »

Arkadaşlar merhaba, delphi xe7 kullanıyorum ve indy udp client kullanarak byte dizisi göndermek istiyorum. IdUDPClient1.Send(edit5.text); komutu ile string veri gönderebiliyorum ama IdUdpClient1.SendBuffer(send_data); komutu ile veri göndermek istediğimde hata alıyorum.Sendbuffer komutunu nasıl kullanabilirim? Bu konuda yardımcı olursanız sevinirim. Kolay gelsin.

[dcc32 Error] delphitest.pas(127): E2250 There is no overloaded version of 'SendBuffer' that can be called with these arguments
ertank
Kıdemli Üye
Mesajlar: 1650
Kayıt: 12 Eyl 2015 12:45

Re: udp send byte hatası

Mesaj gönderen ertank »

Merhaba,

Paylaştığınız bilgiler sorunu anlamak için yeterli değil. Delphi XE7 yok sistemimde. Delphi 10.4.2 ile aşağıdaki kod sorunsuz derlenebiliyor

Kod: Tümünü seç

uses
  IdGlobal,
  IdUDPClient;

procedure TForm1.Button3Click(Sender: TObject);
var
  UDPClient: TIdUDPClient;
  Bytes: TIdBytes;
begin
  SetLength(Bytes, 3);
  Bytes[0] := 0;
  Bytes[1] := 1;
  Bytes[2] := 2;

  UDPClient := TIdUDPClient.Create(nil);
  try
    UDPClient.SendBuffer(Bytes);
  finally
    UDPClient.Free();
  end;
end;
ufukardal
Üye
Mesajlar: 2
Kayıt: 13 Haz 2022 04:46

Re: udp send byte hatası

Mesaj gönderen ufukardal »

Merhaba sorunum SetLength(Bytes, 3); komutunu kullanmamakmış, baktığım örneklerde bu yoktu. gerekli düzenlemeyi yapınca düzeldi. teşekkür ederim.
ertank
Kıdemli Üye
Mesajlar: 1650
Kayıt: 12 Eyl 2015 12:45

Re: udp send byte hatası

Mesaj gönderen ertank »

İlk mesajda paylaştığınız hata parametre olarak kullandığınız "send_data" isimli değişken/sınıf doğru olmadığı için gelir.
SetLength() kullanılmaması durumunda çalışma zamanı hatası oluşacaktır.
Cevapla