Test app UDPSocket Broadcast

New to Gambas? Post your questions here. No question is too silly or too simple.
axisdj
Posts: 19
Joined: Saturday 8th April 2023 8:27pm

Re: Test app UDPSocket Broadcast

Post by axisdj »

BruceSteers wrote: Tuesday 18th April 2023 2:48pm
axisdj wrote: Tuesday 18th April 2023 2:12pm
vuott wrote: Tuesday 18th April 2023 7:23am Sorry, I didn't understand. :|
My suggestion doesn't work?
when I set the instance of the class = nothing it did not destroy instance, and the _free event did not occur

so it was continuing to attempt to send udp packets

I worked around it ...

Please see the project attached and let me know if I am using UDPsocket correctly for broadcasting
the attached project contains no source code.
How did you pack it?
It's best to make an archive using the IDE , select "Project/Make source archive" this will include what is needed and omit what's not needed.

and you should not set "class" = nothing you should set "object" = nothing.
Do you understand the difference? you create an object from the class like this..
Dim hObject = New UDPSocket

then you must do
hObject = Null

not UDPSocket = Null
yes I set the instantiated object = null and I called close on object. Problem is the _free event never occurred

I just noticed that option late yesterday.. here it is attached
Attachments
test-0.0.12.tar.gz
(12.62 KiB) Downloaded 74 times
vuott
Posts: 262
Joined: Wednesday 5th April 2017 6:07pm
Location: European Union

Re: Test app UDPSocket Broadcast

Post by vuott »

I noticed that, if "Timer" and the variable "ws" are both active, they will not allow the hidden Method "_free()" to be raised.

I :? would make these changes:

1)
Public Sub SwitchButton1_Click()
  If SwitchButton1.Value = False Then 
    art.Delete()
    Me.Caption = "UDP Socket Off"
  Else  
  ...etc...etc...
.

2) In "clsArtNet" I'ld add this sub-procedure:
Public Procedure Delete()

  myTimer.Stop
  ws.Close
  ws = Null

End


3) In "clsArtNet" I'ld erase the whole SUB: "Public Sub _free() ".

.
Europaeus sum !

Amare memorentes atque deflentes ad mortem silenter labimur.
axisdj
Posts: 19
Joined: Saturday 8th April 2023 8:27pm

Re: Test app UDPSocket Broadcast

Post by axisdj »

vuott wrote: Wednesday 19th April 2023 1:13am I noticed that, if "Timer" and the variable "ws" are both active, they will not allow the hidden Method "_free()" to be raised.

I :? would make these changes:

1)
Public Sub SwitchButton1_Click()
  If SwitchButton1.Value = False Then 
    art.Delete()
    Me.Caption = "UDP Socket Off"
  Else  
  ...etc...etc...
.

2) In "clsArtNet" I'ld add this sub-procedure:
Public Procedure Delete()

  myTimer.Stop
  ws.Close
  ws = Null

End


3) In "clsArtNet" I'ld erase the whole SUB: "Public Sub _free() ".

.
Thank you and I do understand, but my MAIN question is am I using the udpSocket correctly for broadcasting data. I cannot see the packets on my network.
vuott
Posts: 262
Joined: Wednesday 5th April 2017 6:07pm
Location: European Union

Re: Test app UDPSocket Broadcast

Post by vuott »

Hello,
I currently have no experience with this Class.
I :? don't know if this page can help you:
https://www.gambas-club.de/viewtopic.ph ... 657#p13698
Europaeus sum !

Amare memorentes atque deflentes ad mortem silenter labimur.
axisdj
Posts: 19
Joined: Saturday 8th April 2023 8:27pm

Re: Test app UDPSocket Broadcast

Post by axisdj »

Hello Everyone.

I was able to make it work, the biggest obstacle was the fact that the linux sbc network card had a special setting that needed to be set (detect method I think)

My code did not follow the udpSocket example in the Gambas book, but I got it working so I am well on my way.
Post Reply