SetSocketOption error

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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.
 
Back
Top