Sign in to follow this  
Followers 0
dost0011

Broadcast with UDP doesnt' work

9 posts in this topic

Hi,

I found out in the great forum that I have to use the Version 3.3.1.1 to use broadcast with udp.

I downloaded the beta version and installed it. Then I made a restart and made a new *.au3 file, copied in the source code and compiled it.

No error, but it doesn't work.

My IPAdress is 192.168.178.30 - if the client is sending to 192.168.178.255 it works. But if change the IPAdress of the client to 192.168.255.255

or 255.255.255.255 it doesn't work. No error - nothing.

Do you know if I installed 3.3.1.1 right or did any other mistake?

Many many thanks.

udp_client.au3

udp_server.au3

Share this post


Link to post
Share on other sites



Hi,

When you say it's not working, I have a few questions that might help make things clearer. There could be a couple of issues that I see.

1. What is the IP and Net Mask of the adapter on the system that this script is running from?

2. Have you run Wireshark to see if there is a packet being generated at all?

3. When you said it doesn't work, does that mean that the MsgBox isn't popping up?

The wireshark test would probably be best because it can help you see if the script is generating anything at all as well as tell you if the generated packets are just incorrect.

Justin

Share this post


Link to post
Share on other sites

I tested your solution today and found out that the script is working fine and doing what it is supposed to.

I did see that the 192.168.255.255 did not work. This is expected since your client machine most likely has a 255.255.255.0 netmask on the interface. Once I changed that netmask to 255.255.0.0, the scripts worked great.

Essentially, the system is aware of the size of your subnet. In this case, when you specify the destination as 192.168.255.255 with a client netmask of 255.255.255.0, it thinks that the 192.168.255.XXX network is on a remote subnet. This means that the packets will be sent to the router(Which does not know what to do with it) vs. broadcasting on the local subnet.

Once you change your netmask to 255.255.0.0, it then thinks that the 192.168.255.255 address is a class B broadcast.

If you truly want this to broadcast on the local subnet no matter what your IP address is, you either need to first detect the local subnet and programmatically change the destination broadcast IP or use the Libpcap library to send raw packets and specify the MAC address broadcast (0xFFFFFFFFFFFF)

Hope this helps.

Justin

Share this post


Link to post
Share on other sites

Many thanks !

Life ist sometimes very complicated, if you want to program something, you don't know anything about :-))

I have 2 problems:

I don't know me subnetmask because the damn "ipconfig.exe" in the cmd shows: "Internal error ..."

This is a Windows problem I couldn't solve yet.

But I guess I have a subnet mask "255.255.255.0".

My IPAdress is 192.168.178.30

So do you know which Address I have to use, to get a Communication to 192.168.178.x ?

Do you know, how to see the subnetmask with autoit ?

Many thanks.

Last question for today? I'm reading so much about udf. I read the wiki and some posts in the forum.

But I always have the same problem:

If I want to have a Communication between 2 autoit Programs for example, it would be great if I could use the udf "SetMessage" and "GetMessage".

But I can't find it. There should be a "udf.au3" anywhere, but I don't know where to download these udf ?

In the wiki there are listed some udf - but I don't know the Content of the udf...

Do you know, if there's a list with the udf-commands ?

Share this post


Link to post
Share on other sites

Hi,

I solved the Problem with the broadcast of the client.

The Broadcast-IP Adress was wrong and should be 192.168.178.255.

Thanks.

But now I have a second problem I really don't know to solve:

I want to have one client and several server. The client should send Messages to the servers.

The servers don't have to answer.

If I try to start 2 servers at the same time, the second server don't receive the broadcast message, because UDPBind gets an error. How can I program a server without any socket connections? I guess my examples (see link above) are UDP Point to Point connection...

Many thanks from a newbie...

Share this post


Link to post
Share on other sites

I forgot to mention, that serveral servers could run on one computer equal.

That's why I need to run 2 server programs at the same time on one machine...

How to config the server?

Share this post


Link to post
Share on other sites

I forgot to mention, that serveral servers could run on one computer equal.

That's why I need to run 2 server programs at the same time on one machine...

How to config the server?

Do you mean that you need to have separate server scripts running at the same time while listening on the same port? I'm not sure if I understand exactly what you are needing.

Justin

Share this post


Link to post
Share on other sites

Do you mean that you need to have separate server scripts running at the same time while listening on the same port? I'm not sure if I understand exactly what you are needing.

Yes that's it.

I solved it on my own. I found out, that its impossible to use a port twice on one machine.

This fact has nothing to do with the broadcast sending message.

Broadcast -> sending to all Computers

Port -> sending only to one application.

So I'm using more ports and asking, if the port is free else I use the next one.

It works fine.

Many thanks.

Share this post


Link to post
Share on other sites

Good to hear it!

Justin

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0