I started to work on unity3d. I just wanna send/receive data between Unity3D and Raspberry Pi. I used socket programming for that. But when I try to connect my Raspberry Pi, Unity send me error message that "Unable to connect as no valid cross-domain policy was found". Why cross-domain policy is required. I just wanna send or receive a data between my pc and raspberry. Can I disable cross-domain policy request or how can I solve this problem.
public static void StartClient() {
byte[] bytes = new byte[1024];
int remotePort = xxxx; // My raspberry port
try {
IPHostEntry ipHostInfo = Dns.GetHostEntry("xxx.xxx.xxx.xxx"); //-->> my raspberry IP
IPAddress ipAddress = ipHostInfo.AddressList[0];
IPEndPoint remoteEP = new IPEndPoint(ipAddress,remotePort);
Socket mySocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp );
try {
mySocket.Connect(remoteEP);
print("Socket connected to" + mySocket.RemoteEndPoint.ToString());
byte[] msg = Encoding.ASCII.GetBytes("This is a test<EOF>");
int bytesSent = mySocket.Send(msg);
int bytesRec = mySocket.Receive(bytes);
print("Echoed test = " + Encoding.ASCII.GetString(bytes,0,bytesRec));
mySocket.Shutdown(SocketShutdown.Both);
mySocket.Close();
}
catch (ArgumentNullException ane) {
print("ArgumentNullException : " + ane.ToString());
}
catch (SocketException se) {
print("SocketException : " + se.ToString());
}
catch (Exception e) {
print("Unexpected exception : " + e.ToString());
}
}
catch (Exception e) {
Console.WriteLine( e.ToString());
}
}