I'm using socket programming to send live audio from my mobile to Desktop. I'm using C# language in Desktop side and JAVA in Mobile side. In desktop side I am receiving the audio that is send by mobile and is in the form of bytes. Can someone tell how I would convert these bytes that I have read from socket to audio file ? Below is, how I am reading bytes from socket
Console.WriteLine("Program started!!");
TcpClient client = null;
client = new TcpClient("192.168.0.113", 9999);
if (client.Connected)
{
Console.Write("Client connected" );
NetworkStream ns = client.GetStream();
StreamReader sr = new StreamReader(ns);
byte[] buffer = new byte[2048];
ns.Read(buffer, 0, buffer.Length);
Console.Write("Server>> " + sr.ReadLine());
Console.Write("\n Audio Bytes are " );
foreach (byte b in buffer )
{
if (b!=0)
{
Console.Write(b);
//TODO Convert these bytes
}
}
Console.Read();
}