84 public static Socket mSocket = null;
94 mSocket =
new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
98 IPAddress ip = IPAddress.Parse(LocalIP);
99 IPEndPoint ipe =
new IPEndPoint(ip, LocalPort);
101 mSocket.Connect(ipe);
106 int radomKey=radom.Next(100000,999999);
108 string strKey=radomKey.ToString();
149 Debug.Log(e.ToString());
154 public static void Send(
short data)
157 mSocket.Send(longth);
161 public static void Send(
long data)
164 mSocket.Send(longth);
168 public static void Send(
int data)
171 mSocket.Send(longth);
175 public static void Send(
string data)
177 byte[] longth=Encoding.UTF8.GetBytes(data);
178 mSocket.Send(longth);
184 byte[] recvBytes =
new byte[2];
185 mSocket.Receive(recvBytes,2,0);
192 byte[] recvBytes =
new byte[4];
193 mSocket.Receive(recvBytes,4,0);
200 byte[] recvBytes =
new byte[8];
201 mSocket.Receive(recvBytes,8,0);
208 byte[] recvBytes =
new byte[length];
209 mSocket.Receive(recvBytes,length,0);
210 string data=Encoding.UTF8.GetString(recvBytes);
static long ReceiveLong()
static short getShort(byte[] buf, bool asc)
static void Send(short data)
static void Send(long data)
static int getInt(byte[] buf, bool asc)
static short ReceiveShort()
!WiP Includes FLAGS of GUI.
static long getLong(byte[] buf, bool asc)
static void Send(string data)
static void Send(int data)
static string ReceiveString(int length)
static byte[] getBytes(short s, bool asc)
static void SocketConnection(string LocalIP, int LocalPort)