I'm in the process of creating a multicast application but I'm having
difficulty getting the UDPClient to work. The UDPClient works on my local
machine only, not across the network. I've been able to get the multicast
message to work across a network by creating a socket, but I can't get it to
work via UDPClient. What is the difference between the two? Why does the
socket method work and not the UDPClient? Thanks
*****************SOCKET METHOD*********************
Socket s=new Socket(AddressFamily.InterNetwork, SocketType.Dgram,
ProtocolType.Udp);
s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new
MulticastOption(ip));
s.SetSocketOption(SocketOptionLevel.IP,
SocketOptionName.MulticastTimeToLive, int.Parse(ttl));
IPEndPoint ipep=new IPEndPoint(IPAddress.Parse(mcastGroup),int.Parse(p ort));
s.Connect(ipep);
*********************UDPCLIENT METHOD***********************
udpClient = new UdpClient();
groupEP = new IPEndPoint(groupAddress, groupPort);
int sendBytes = udpClient.Send(data, data.Length, groupEP); 2 7201
I believe you need to make a call to JoinMulticastGroup on the UdpClient
class. This method allows you to supply the multicast address and the TTL.
HTH
Dan
"chewie" wrote: I'm in the process of creating a multicast application but I'm having difficulty getting the UDPClient to work. The UDPClient works on my local machine only, not across the network. I've been able to get the multicast message to work across a network by creating a socket, but I can't get it to work via UDPClient. What is the difference between the two? Why does the socket method work and not the UDPClient? Thanks
*****************SOCKET METHOD*********************
Socket s=new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(ip));
s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, int.Parse(ttl));
IPEndPoint ipep=new IPEndPoint(IPAddress.Parse(mcastGroup),int.Parse(p ort));
s.Connect(ipep);
*********************UDPCLIENT METHOD***********************
udpClient = new UdpClient(); groupEP = new IPEndPoint(groupAddress, groupPort); int sendBytes = udpClient.Send(data, data.Length, groupEP);
I believe you need to make a call to JoinMulticastGroup on the UdpClient
class. This method allows you to supply the multicast address and the TTL.
HTH
Dan
"chewie" wrote: I'm in the process of creating a multicast application but I'm having difficulty getting the UDPClient to work. The UDPClient works on my local machine only, not across the network. I've been able to get the multicast message to work across a network by creating a socket, but I can't get it to work via UDPClient. What is the difference between the two? Why does the socket method work and not the UDPClient? Thanks
*****************SOCKET METHOD*********************
Socket s=new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(ip));
s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, int.Parse(ttl));
IPEndPoint ipep=new IPEndPoint(IPAddress.Parse(mcastGroup),int.Parse(p ort));
s.Connect(ipep);
*********************UDPCLIENT METHOD***********************
udpClient = new UdpClient(); groupEP = new IPEndPoint(groupAddress, groupPort); int sendBytes = udpClient.Send(data, data.Length, groupEP);
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: news.microsoft.com |
last post by:
Hi
I write dll library which one of it component will be Net socket
communication. Communication is working very good, but i've got problem when
client is connecting. When server is started,...
|
by: Michael Rybak |
last post by:
hi, everyone.
I'm writing a 2-players game that should support network mode. I'm now
testing it on 1 PC since I don't have 2. I directly use sockets, and
both client and server do...
|
by: Usman |
last post by:
Hi
I'm having problem with a scenarion where I have a server written in C# and
client written in VC6++.
Here is the server code that i'm using including the Callback function for
handling...
|
by: Macca |
last post by:
My app has an asynchronous socket server. It will have 20 clients connected
to the server. Each client sends data every 500 millisecondsThe Connections
once established will not be closed unless...
|
by: ahlongxp |
last post by:
Hi, everyone,
I'm implementing a simple client/server protocol.
Now I've got a situation:
client will send server command,header paires and optionally body.
server checks headers and decides...
| |
by: khu84 |
last post by:
Here is client server very simple code, seems to work with telnet but with with web client code gives blank output.
Following is the server code:-
<?php
function...
|
by: nsaffary |
last post by:
hi
I hava a client/server program that run correctly when i run it in one computer(local) but when I run client on a one computer and run server run on another, connection does not stablish.(I set...
|
by: 7stud |
last post by:
My question pertains to this example:
#!/usr/bin/env python
import socket, sys, time
host = sys.argv
textport = sys.argv
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
by: tsic |
last post by:
Bonjour,
je suis bloqué ilya preque 2 semaines dans le code suivant. je veut que le client et le serveur envoyent leurs message d'une maniere comme msn. je crois qu'ilya quelque chose à ajouter dans...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |