유니티 네트워크 (Unity Socket with Thread) feat. Marshal
Server ----------------------------------------------- using UnityEngine; using System; using System.Collections; using System.Net; using System.Net.Sockets; using System.Threading; using UnityEngine.UI; using System.Runtime.InteropServices; public class StateObject { public Socket workSocket = null; public const int BufferSize = 10240; public byte[] buffer = new byte[BufferSize]; //public StringBuilder sb = new StringBuilder(); } public struct PackData { public int width; public int height; public int size; public void GetData(byte[] bytes, Type type) { IntPtr buff = Marshal.AllocHGlobal(bytes.Length); Marshal.Copy(bytes, 0, buff, bytes.Length); object ob = Marshal.PtrToStructure(buff, type); this = (PackData)ob; ...