Home > Software engineering >  UDP broadcast can't send, can you come in?
UDP broadcast can't send, can you come in?

Time:11-03

Post code first:
 # coding: utf-8 

The import socket, sys

Dest=(' 255.255.255.255, 6666)

S=socket. The socket (socket. AF_INET, socket. SOCK_DGRAM)
S.s etsockopt (socket. SOL_SOCKET, socket SO_BROADCAST, 1)

S.s endto (" hello ", dest)

Print "& for the replies: press Ctrl + c to stop"
While 1:
(address, buf)=s.r ecvfrom (1024)
If not len (buf) :
Break
Print "Revived the from % s: % s" % (address, buf)


This time, how to send all not to go out, but the IP subnet to my radio,
Dest=(6666) '192.168.15.255,
Why is this? Is there a way to make full of 255 can also broadcast?
Some say the router's problem, but I use a mobile phone has been broadcast, with 255.255.255.255 is successful, the code was written by someone else I will not to come out,

CodePudding user response:

You'll have to put TTL set to 1

CodePudding user response:

What system are you? Different system for broadcasting and processing are not identical, theoretically you subnet broadcast all over 255 radio range are equivalent, because all the radio is not a limit on the router or vlan,

CodePudding user response:

refer to the second floor kinkon007 response:
what system are you? Different system for broadcasting and processing are not identical, theoretically you subnet broadcast all over 255 radio range are equivalent, because all the radio is not a limit on the router or vlan,
I get IP access to the virtual machine's IP, is I set xx. Xx. Xx. 1, so I doubted my radio all ran to the network in the virtual machine

CodePudding user response:

reference 1st floor cutmelon response:
you'll have to put TTL set to 1.
seemingly has nothing to do with this,

CodePudding user response:

To 255.255.255.255 send packets, the packets will not be routing, it can only get to all hosts in the physical network, the radio call broadcasting limited,

CodePudding user response:

You in the virtual machine, network routing does not go out

CodePudding user response:

refer to 6th floor WUYUAN2011WOAINI response:
you in virtual machine, the network is a routing out

I'm not in the virtual machine, I am the normal machine, but the virtual machine installation, I hair broadcast in the win, not found, then the virtual machine network adapter is disabled found that would have been sent out, I found that in python, take the machine IP address, to give out the virtual machine's IP,
  • Related