Home > Net >  UDP broadcast error, "socket operation attempt are unable to connect to host a"
UDP broadcast error, "socket operation attempt are unable to connect to host a"

Time:12-16

Private Sub Button1_Click (ByVal sender As System. Object, ByVal e the As System. EventArgs) Handles for. Click
Dim As Socket s
S=New Socket (AddressFamily. InterNetwork, SocketType Dgram, ProtocolType. Udp)
S.S etSocketOption (SocketOptionLevel Socket, SocketOptionName Broadcast, True)
Dim ep As IPEndPoint
Ep=New IPEndPoint (IPAddress. Broadcast, 1500)

Dim the data () As Byte
Data=https://bbs.csdn.net/topics/Encoding.ASCII.GetBytes (" Hello ")
S.S endTo (data, ep)
S.C lose ()

End Sub

Code execution by s.S endTo (data, ep) will be an error, prompt information such as title,

Rookie help!
  • Related