Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
UDP broadcast message fails
#1
Dear All; here's another easy one. I'm trying to send out a udp broadcast msg like this:

Code:
object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 254
  ClientWidth = 535
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Memo1: TMemo
    Left = 8
    Top = 40
    Width = 293
    Height = 206
    Lines.Strings = (
      'Memo1')
    TabOrder = 0
  end
  object Button1: TButton
    Left = 12
    Top = 8
    Width = 75
    Height = 25
    Caption = 'Button1'
    TabOrder = 1
    OnClick = Button1Click
  end
  object IdUDPClient1: TIdUDPClient
    BroadcastEnabled = True
    Port = 0
    Left = 364
    Top = 28
  end
end

Code:
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <IdBaseComponent.hpp>
#include <IdComponent.hpp>
#include <IdUDPBase.hpp>
#include <IdUDPClient.hpp>
class TForm1 : public TForm{
__published: // IDE-managed Components
  TMemo *Memo1;
  TButton *Button1;
  TIdUDPClient *IdUDPClient1;
  void __fastcall Button1Click(TObject *Sender);
private: // User declarations
public: // User declarations
  __fastcall TForm1(TComponent* Owner);
};
extern PACKAGE TForm1 *Form1;
#endif

Code:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner){}
void __fastcall TForm1::Button1Click(TObject *Sender){
  try{
    IdUDPClient1->Broadcast( "This is a test. Ignore it.", 45242 );
  }catch( EIdException &e ){
    Memo1->Lines->Add( e.Message );
  }
}
//---------------------------------------------------------------------------

When the Button1 is clicked - nothing visible happens, so I look at the WireShark dump but I have no idea what is going on (see attached). Please help. TIA.
Reply


Messages In This Thread
UDP broadcast message fails - by Boba TC - 07-18-2019, 03:49 AM
RE: UDP broadcast message fails - by Boba TC - 07-18-2019, 05:51 PM
RE: UDP broadcast message fails - by rlebeau - 07-18-2019, 10:22 PM
RE: UDP broadcast message fails - by Boba TC - 07-19-2019, 02:26 AM
RE: UDP broadcast message fails - by rlebeau - 07-19-2019, 09:55 PM
RE: UDP broadcast message fails - by Boba TC - 07-20-2019, 02:08 AM
RE: UDP broadcast message fails - by Boba TC - 08-17-2019, 04:35 AM
RE: UDP broadcast message fails - by rlebeau - 08-17-2019, 07:22 AM
RE: UDP broadcast message fails - by Boba TC - 07-20-2019, 08:09 PM
RE: UDP broadcast message fails - by rlebeau - 07-23-2019, 09:35 PM
RE: UDP broadcast message fails - by Boba TC - 08-22-2019, 12:53 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)