I receive data from an external application through TCP sockets. I want to convert the received string data into float. But I get this format exception:input string not in correct format error. I checked out the forum on this this and tried all possible answers that were given. Still not able to figure it out. Someone plz help.
This is my code :
//Receive TCP data
Byte[] data = new Byte[256];
Int32 bytes = stream.Read(data, 0, data.Length);
string recddata = System.Text.Encoding.ASCII.GetString(data, 0, bytes);
if(recddata != "")
{
message = recddata;
float cmove = float.Parse(message);
}
↧