- Home /
Input string is not in correct format
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);
}
Answer by ScroodgeM · Aug 10, 2012 at 08:45 PM
simply check data you got on input. if you got message 'input string not in correct format error', then input string not in correct format. i will be very surprised if it's not 8)
debug.log all data that goes to input parser and post it here if need explained.
Your answer
![](https://koobas.hobune.stream/wayback/20220613075454im_/https://answers.unity.com/themes/thub/images/avi.jpg)