473,385 Members | 1,329 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,385 software developers and data experts.

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(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

--
-iwdu15
Apr 16 '07 #1
1 1672
On Apr 16, 6:56 am, iwdu15 <jmmgoalsteratyahoodotcomwrote:
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

--
-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
Apr 16 '07 #2

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

Similar topics

0
by: Nathan Kerr | last post by:
I have been working with KB Article 812404 "HOW TO: Write Pluggable Protocol to Supprot FTP in Managed Classes by Using Visual Bassic.NET". I have modified the code to run on a Pocket PC. In the...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
2
by: Wencheng Magiya | last post by:
By setting socket.SetSocketOption(SocketOptionLevel.Socket,SocketOptionName.KeepAlive, 1 ) can tell the socket to use keep-alives. But anybody know how to set the timeout for the keep-alive...
3
by: Ryan Liu | last post by:
Hi, I use Server: Use an endless thread to lisiten to clients requests: while(true) { TcpClient client = myListener.AcceptTcpClient();
0
by: morgan22 | last post by:
Hi I'm trying to build a sniffer-like application and I'm using this code : Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Raw,...
1
by: santoo | last post by:
Hi Guys, I am using Socket for UDP communication in C#. My application send receive data using Socket. While sending data, I am sending data on same port where I am receiving it, Other server...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.