Dear All; here's another easy one. I'm trying to send out a udp broadcast msg like this:
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.
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.