uses
  Crt,
  CoBase,
  CoIPv4,
  CoUDP,
  CoPktDrv;


{const
  Intf1Addr : TIpxAddress = (
    Size: SizeOf(TIpxAddress);
    Net:  (Long:0);
    Node: (Bytes:(0, 80, 252, 33, 19, 153));
    Sock: 5000
  );


  Intf2Addr : TIpxAddress = (
    Size: SizeOf(TIpxAddress);
    Net:  (Long:0);
    Node: (Bytes:(0, 80, 252, 33, 19, 154));
    Sock: 5001
  );}

const

  Buff1     : array[0..100] of Char = 'Text posilany protokolem UDP'#0;

var
  Status   : TCoStatus;

  S        : String;

  Buff2     : array[0..1535] of Char;

  RecvLen   : Word;

  Ovlp1     : TOverlapped;
  Ovlp2     : TOverlapped;

  UdpAddr   : TUdpAddress;

  TempSock  : PCoDevice;
  Sock      : PCoDevice;

  I         : Integer;

begin
  ClrScr;

{  for I := Low(Buff1) to High(Buff1) do Buff1[I] := $CD;}

  if CoCreateDevice( 'PKTDRV', 'ETH_A', 'INT=$60',
       nil, Sock ) <> CST_SUCCESS then
  begin
    WriteLn( 'Nelze vytorit instanci PKTDRV' );
    Exit;
  end;

  Status := Sock^.CoBind( @UdpAddr, COF_PROPAGATE, nil );
  if Status <> CST_SUCCESS then
  begin
    WriteLn( 'Bind, ', CoStatusToStr( Status ) );
  end;


  repeat

    Sock^.CoTick;

  until KeyPressed;

  Status := Sock^.CoUnbind( COF_PROPAGATE, nil );

  if Status <> CST_SUCCESS then
  begin
    WriteLn( '1_Unbind, Error:', Status );
  end;

end.