all groups > dotnet distributed apps > march 2004 >
You're in the

dotnet distributed apps

group:

LAN Broadcasting with C#



LAN Broadcasting with C# Manuel
3/30/2004 6:21:12 AM
dotnet distributed apps: Hello all

I am attempting to broadcast IPv6 messages in a LAN and process every broadcast reply, storing the IP of each individual machine replying to the broadcast

I have the code

broadcastSocket.SetSocketOption(SocketOptionLevel.IPv6,SocketOptionName.Broadcast,0);

public void doBroadcast(

tr

IPAddress broadcastAddress = IPAddress.Parse("255.255.255.255"); // i.e, broadcas
int broadcastPort = 1501
IPEndPoint broadcastEndPoint = new IPEndPoint(broadcastAddress, broadcastPort)
broadcastSocket.Connect(broadcastEndPoint);
}
catch(Exception ex

MessageBox.Show("Generic exception caught while attempting to broadcast: " + ex.ToString())


1 - How do I send the actual packet ?
2 - Which mechanism do I use to process the reply packet

Thank you

Re: LAN Broadcasting with C# Feroze [MSFT]
4/1/2004 11:21:27 AM
1) You can use SendTo & ReceiveFrom to send & receive packets.
2) In your code below, you are parsing an IPv4 broadcast address, whereas
you want to send on the IPv6 broadcast. Make sure you set your endpoint in
SendTo correctly

--
Remove "user" from the email address to reply to the author.

This posting is provided "AS IS" with no warranties, and confers no rights

Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm




[quoted text, click to view]
broadcast reply, storing the IP of each individual machine replying to the
broadcast.
[quoted text, click to view]
broadcastSocket.SetSocketOption(SocketOptionLevel.IPv6,SocketOptionName.Broa
dcast,0);
[quoted text, click to view]

AddThis Social Bookmark Button