Click here to Skip to main content
15,894,540 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I'm developing a C#.Net application for Voice Chatting using Direct-X.

I'm able to send or receive voice over a particular IP, but I don't know how to broadcast voice over LAN to all available IP's.
I have to only send voice message to all IP's, not to receive from them.

Thank's in advance.
Posted
Updated 14-Mar-11 23:33pm
v2
Comments
Dalek Dave 15-Mar-11 5:34am    
Edited for Grammar and Readability

If you want to use broadcast use UDP instead of TCP

Like this:

C++
//UDP Listener(client)
            Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            System.Net.IPEndPoint iep = new System.Net.IPEndPoint(System.Net.IPAddress.Any, 777);
            s.Bind((System.Net.EndPoint)iep);
            byte[] data = new byte[1024];

            s.Receive(data);

            //UDP Broadcaster(server)
            Socket broadcaster = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            System.Net.IPEndPoint iep2 = new System.Net.IPEndPoint(System.Net.IPAddress.Broadcast, 777);
            s.Connect((System.Net.EndPoint)iep2);
            byte[] data2 = new byte[1024];

            broadcaster.Send(data2);
 
Share this answer
 
v2
The Easiest way to use DirectX in C# is DirectShowNet library. You should get audio's chunks and send them to clients.
Solution become more difficult when you get these chunks and begin to concatenate them...
I think you should create special class which must be multi-threaded.
One of thread collects chunks in the memory stream and another one should read it from the same stream at runtime.

Sorry for my English :)
 
Share this answer
 
could you please send me source code?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900