SetSocketOption error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?aXdkdTE1?=

    #1

    SetSocketOption error

    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(AddressF amily.InterNetw ork, SocketType.Raw,
    ProtocolType.Ud p)

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

    soc.SetSocketOp tion(SocketOpti onLevel.Socket, SocketOptionNam e.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.Non e, New
    IPEndPoint(IPAd dress.Broadcast , PORT), AddressOf CallBack, soc)

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

    --
    -iwdu15
  • Tom Shelton

    #2
    Re: SetSocketOption error

    On Apr 16, 6:56 am, iwdu15 <jmmgoalsteraty ahoodotcomwrote :
    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(AddressF amily.InterNetw ork, SocketType.Raw,
    ProtocolType.Ud p)
    >
    i get the data into a byte array, then i try to set the socket options and
    it works fine
    >
    soc.SetSocketOp tion(SocketOpti onLevel.Socket, SocketOptionNam e.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.Non e, New
    IPEndPoint(IPAd dress.Broadcast , PORT), AddressOf CallBack, soc)
    >
    PORT is an integer constant with the value of 11000. any help would be
    great, thanks
    >
    --
    -iwdu15
    1) Raw Sockets were removed from Windows XPSP2
    2) Raw Sockets (when they did exist) requires that the application
    have admin privledges.

    --
    Tom Shelton


    Comment

    Working...