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

Test app UDPSocket Broadcast

Post by axisdj »

Here is my first test app.

Trying to broadcast udp packets.

few questions.

1. From what I can tell once I create an object I cannot destroy it (vb6 set object = nothing)?

2. I could not find an example of udpsocket, so I took hints from socket example, please be gentle it is my first try

3. What is the easiest way to get localIP of machine

to clarify the udpsock status returns 1 but i cannot see any packets being sent on my network

thank you
Attachments
test.zip
(12.55 KiB) Downloaded 69 times
vuott
Posts: 262
Joined: Wednesday 5th April 2017 6:07pm
Location: European Union

Re: Test app UDPSocket Broadcast

Post by vuott »

axisdj wrote: Monday 17th April 2023 7:41pm 1. From what I can tell once I create an object I cannot destroy it (vb6 set object = nothing)?
In Gambas some Objects, especially graphic ones, possess the ".Delete()" Method in order to be destroyed.
In order to destroy, however, those Objects which do not have the .Delete() Method, it is sufficient to assign the value Null to the variable of the specific Object type.
object_variable = Null
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 »

Ok thanks, I tried that and the class that had the timer and udpsocket was not getting destroyed and the _free event was not occuring

Any help on why my test app is not broadcasting the data, would be greatly appreciated when you have time
vuott
Posts: 262
Joined: Wednesday 5th April 2017 6:07pm
Location: European Union

Re: Test app UDPSocket Broadcast

Post by vuott »

Sorry, I didn't understand. :|
My suggestion doesn't work?
Europaeus sum !

Amare memorentes atque deflentes ad mortem silenter labimur.
vuott
Posts: 262
Joined: Wednesday 5th April 2017 6:07pm
Location: European Union

Re: Test app UDPSocket Broadcast

Post by vuott »

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: 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
axisdj
Posts: 19
Joined: Saturday 8th April 2023 8:27pm

Re: Test app UDPSocket Broadcast

Post by axisdj »

vuott wrote: Tuesday 18th April 2023 7:44am
axisdj wrote: Monday 17th April 2023 7:41pm3. What is the easiest way to get localIP of machine
I :? don't know if these pages can help you:
https://gambaswiki.org/wiki/comp/gb/system/host
https://gambaswiki.org/wiki/comp/gb.net/dnsclient
https://gambaswiki.org/wiki/doc/network
https://gambas-buch.de/dwen/doku.php?id ... .3.1:start
https://gambas-buch.de/dwen/doku.php?id ... .1.4:start
https://www.gambas-it.org/wiki/index.ph ... a_macchina
By using "Shell" function with one of the commands indicated on this page:
https://opensource.com/article/18/5/how ... ress-linux
thanks!, very simple
User avatar
BruceSteers
Posts: 1565
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Test app UDPSocket Broadcast

Post by BruceSteers »

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
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1565
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Test app UDPSocket Broadcast

Post by BruceSteers »

Are you closing the socket first?
http://gambaswiki.org/wiki/comp/gb/stream/close
If at first you don't succeed , try doing something differently.
BruceS
vuott
Posts: 262
Joined: Wednesday 5th April 2017 6:07pm
Location: European Union

Re: Test app UDPSocket Broadcast

Post by vuott »

BruceSteers wrote: Tuesday 18th April 2023 2:48pm 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
Infact. 👍
BruceSteers offers you an important clarification.
Europaeus sum !

Amare memorentes atque deflentes ad mortem silenter labimur.
Post Reply