|
-
Feb 16th, 2008, 10:12 PM
#1
Re: Multiple UDP listeners
After further testing, I found that this line is causing a problem:
locUDPOut.SendTo(bytearray,length,broadcast,broadcastIP)
I altered the arguments to simplify them, but they are correct. The first argument is a byte array, the second is the length, the third is a socketflag setting of broadcast, and the last is a IPEndPoint set to IPAddress.Broadcast.
The error I am getting is 10045, which is "The attempted operation is not supported for the type of object referenced."
Therefore, the reason I am not getting anything in is because I am not sending anything out. locUDPOut was orignally a UDPClient object and was only used for sending data. Since you don't get to SetSocketOptions on a UDPClient, and I had no reason not to be using the underlying Socket directly, so I switched. In fact, in another app, I need to use the socket, because I understand the UDPListener class is buggy, so for bi-directional stuff on a socket I should just use the socket class. If I'm going to use it in one case, might as well use it in all cases.
At first I was using Send, but that only works on a connected socket. Apparently it worked for UDPClient, since I had that working between two computers, and now that I have changed the UDPClient to just a socket, Send eventually gives me an error (but takes some time doing so). Because of this, it looked like I should be using SendTo instead of Send, but I'm getting the exact same error with SendTo as I did with Send.
Back to the internet....and here I am.
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|