Autor Beitrag
hazelnoot
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: Do 03.08.06 09:37 
Hi!

ich hab mal ne kleine frage an euch wie erstelle ich einen einfachen UDP client mit indy? also wie fange ich da am besten an in welcher reihenfolge muss ich welche sachen machen? waer super wann ihr mir da weiterhelfen koenntet!

danke!

ps das ganze sollte in der konsole funktionieren!!

//edit
folgendes hab ich schon:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
unit UdpClass;

interface
  uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, IdUDPServer, IdBaseComponent, IdComponent, IdUDPBase,
  IdUDPClient, IdGlobal, IdSocketHandle;

type
  UdpTestClass = class(TObject)
    client : TIdUDPClient;
    procedure createSocket(ip : string; port : integer);
    procedure IdUDPServer1UDPRead(Sender: TObject; AData: TBytes; ABinding: TIdSocketHandle);
  end;

implementation
  procedure UdpTestClass.createSocket(ip: string; port: Integer);
  begin
    try
      client.Host := ip;
      client.Port := port;
      client.Active := True;
    except
      Writeln('Fehler beim Verbinden des Clients.');
    end;
  end;

  procedure UdpTestClass.IdUDPServer1UDPRead(Sender: TObject; AData: TBytes; ABinding: TIdSocketHandle);
  begin

  end;

end.


aber in der zeile "client.Host := ip;" wird mir eine exeption geworfen warum... was mache ich falsch?

Danke mfg hazelnoot
SAiBOT
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 323
Erhaltene Danke: 6

XP SP2; 7
D7; D2009
BeitragVerfasst: Do 03.08.06 13:30 
ausblenden Delphi-Quelltext
1:
client := TidUDPClient.Create(nil);					
hazelnoot Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: Do 03.08.06 14:35 
ooo danke!!

jetzt funkelts :-)
danke!

mfg hazelnoot