473,395 Members | 1,556 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

sending UDP packet to broadcast address

Hi, im trying to broadcast a UDP packet to my networks broadcast address
(192.168.255.255) which i have verified with my network admin is the correct
address. i can ping that address and get responses from the other computers
on the network (via the command prompt) but when i attempt to send a UDP
packet, it does not go through. there are no errors, however, i am listening
on another computer on the same port, but the packet is not received. heres
the code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim socSend As New Socket(AddressFamily.InterNetwork,
SocketType.Dgram, ProtocolType.Udp)

Dim bt() As Byte =
System.Text.ASCIIEncoding.ASCII.GetBytes(Dns.Resol ve(Dns.GetHostName).AddressList(0).ToString & "-" & "user.name")

socSend.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.Broadcast, 1)
socSend.SendTo(bt, 0, bt.Length, SocketFlags.None, New
IPEndPoint(Dns.Resolve("192.168.255.255").AddressL ist(0), SEND_PORT))

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click

socServer = New Socket(AddressFamily.InterNetwork, SocketType.Dgram,
ProtocolType.Udp)

ReDim btServer(4095)

socServer.Bind(New
IPEndPoint(Dns.Resolve(Dns.GetHostName).AddressLis t(0), PORT))

Call Poll()

End Sub

Private Sub Poll()

While True

If socServer.Available 0 Then socServer.Receive(btServer, 0,
SocketFlags.None)

' Me.Invalidate(True)
Application.DoEvents()

ParseText(btServer)

End While

End Sub

both SEND_PORT and PORT are constants (11500 and 11000). any help would be
great. thanks

--
-iwdu15
Apr 19 '07 #1
0 1479

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: D. Patrick | last post by:
I need to duplicate the functionality of a java applet, and how it connects to a remote server. But, I don't have the protocol information or the java source code which was written years ago. ...
9
by: Miro | last post by:
VB 2003 at the end of the code, this works great. bytCommand = Encoding.ASCII.GetBytes("testing hello send text") udpClient.Send(bytCommand, bytCommand.Length) and this recieves it Dim...
0
by: cornish.julia | last post by:
The following code is intended to construct a SYN header and send it to a host (just the localhost at the moment) to form part of a port scanner tool for network security. However, the packet that...
1
by: Rich | last post by:
Hello, I am working on a python library for sending and receiving data from a Subaru's ECU (the fuel injection computer) via the OBD-II port and an OBD to USB cable, with the Subaru Select Monitor...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.