SetSocketOption error

G

Guest

hi, im trying to send a broadcast out to my network using a UDP socket. heres
how i initialize it.

Dim soc As New Socket(AddressFamily.InterNetwork, SocketType.Raw,
ProtocolType.Udp)

i get the data into a byte array, then i try to set the socket options and
it works fine

soc.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1)

however, when i use the SendTo method, it throws a socket exception saying i
am tryibng to access the socket in ways i dont have permissions. i do have
permissions to create sockets (i dont have admin permissions but i have used
sockets on this network before, and im a poweruser). it throws the error at
this line:

soc.BeginSendTo(bt, 0, bt.Length, SocketFlags.None, New
IPEndPoint(IPAddress.Broadcast, PORT), AddressOf CallBack, soc)

PORT is an integer constant with the value of 11000. any help would be
great, thanks
 
T

Tom Shelton

hi, im trying to send a broadcast out to my network using a UDP socket. heres
how i initialize it.

Dim soc As New Socket(AddressFamily.InterNetwork, SocketType.Raw,
ProtocolType.Udp)

i get the data into a byte array, then i try to set the socket options and
it works fine

soc.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1)

however, when i use the SendTo method, it throws a socket exception saying i
am tryibng to access the socket in ways i dont have permissions. i do have
permissions to create sockets (i dont have admin permissions but i have used
sockets on this network before, and im a poweruser). it throws the error at
this line:

soc.BeginSendTo(bt, 0, bt.Length, SocketFlags.None, New
IPEndPoint(IPAddress.Broadcast, PORT), AddressOf CallBack, soc)

PORT is an integer constant with the value of 11000. any help would be
great, thanks

1) Raw Sockets were removed from Windows XPSP2
2) Raw Sockets (when they did exist) requires that the application
have admin privledges.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top