hello! We make game and have problems with socket data transfer on Android. We can connect use socket to server but when we send any data to server (using method SendData()) there is not happen anything (I mean no errors, or receiving data on server), but this code work fine on pc in editor. Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Net.Sockets; using System.Net; using System; using System.IO; using System.Text; public class ServerConnector { const int READ_BUFFER_SIZE = 255; private TcpClient client; private byte[] readBuffer = new byte[READ_BUFFER_SIZE]; public string strMessage=string.Empty; public string res=String.Empty; private string pUserName; public ServerConnector() { m_state = ServerState.Connect; } private ServerState m_state; //Server StartUp public string fnConnectResult(string sNetIP, int iPORT_NUM,string sUserName) { try { Debug.Log("StartFnConnect"); pUserName =sUserName; // The TcpClient is a subclass of Socket, providing higher level // functionality like streaming. client = new TcpClient(sNetIP, iPORT_NUM); // Start an asynchronous read invoking DoRead to avoid lagging the user // interface. Debug.Log("BeginRead"); client.GetStream().BeginRead(readBuffer, 0, READ_BUFFER_SIZE, new AsyncCallback(DoRead), null); // Make sure the window is showing before popping up connection dialog. Debug.Log("Connection Succeeded"); // AttemptLogin(sUserName); m_state = ServerState.Initialization; return "Connection Succeeded"; } catch(Exception ex) { Debug.Log (ex.Message); return "Server is not active. Please start server and try again. " + ex.ToString(); } } //Server Callback private void DoRead(IAsyncResult ar) { int BytesRead; try { // Finish asynchronous read into readBuffer and return number of bytes read. BytesRead = client.GetStream().EndRead(ar); if (BytesRead < 1) { // if no bytes were read server has close. Debug.Log("no bytes were read server has close."); return; } // Convert the byte array the message was saved into, minus two for the // Chr(13) and Chr(10) strMessage = Encoding.ASCII.GetString(readBuffer, 0, BytesRead - 2); Debug.Log(strMessage); ProcessCommands(strMessage); // Start a new asynchronous read into readBuffer. client.GetStream().BeginRead(readBuffer, 0, READ_BUFFER_SIZE, new AsyncCallback(DoRead), null); } catch { Debug.Log("Disconnected"); } } public void SendPowerUp() { //SendData("PowerUp|"); } public void SendAiming(ThrowData aiming) { SendData(LitJson.JsonMapper.ToJson(aiming)); //SendData("PowerUp|"); } public void StartGame() { int id = UnityEngine.Random.Range(0, 2); CurrentGameData.PlayerID = id; CurrentGameData.PlayerNumber = id; if(id == 1) id = 0; else id = 1; JsonGameData data = new JsonGameData(id, id); SendData(LitJson.JsonMapper.ToJson(data)); } // Process the command received from the server, and take appropriate action. private void ProcessCommands(string data) { switch (m_state) { case ServerState.Connect: Debug.Log("Connect State" + data); break; case ServerState.Initialization: Debug.Log("Initialization State" + data); // ServerActions.ParseJsonToInitData (data); m_state = ServerState.GameMode; break; case ServerState.GameMode: Debug.Log("GameMode State" + data); ServerActions.ParseJsonToThrowDataData(data); break; case ServerState.Disconnect: Debug.Log("Disconnect State" + data); break; default: break; } } // Use a StreamWriter to send a message to server. public void SendData(string data) { StreamWriter writer = new StreamWriter(client.GetStream()); writer.AutoFlush = true; writer.WriteLine (string.Format("{0}",data)); writer.Flush(); } public void CloseSocket(){ client.Close (); } }