예제 #1
0
 /*void BeginSend (string code)
  * {
  *      byte[] bufferOut = Encoding.ASCII.GetBytes("<TRIGGER>"+code+"</TRIGGER>");
  *      //byte[] bufferOut = Encoding.ASCII.GetBytes(code);
  *      Debug.Log("Sending " + code.ToString() + " (string)\n");
  *      socket.BeginSend(bufferOut, 0, bufferOut.Length, SocketFlags.None, new AsyncCallback (OnSend), this);
  * }
  * void BeginSend (string code)
  * {
  *      //byte[] bufferOut = Encoding.ASCII.GetBytes("<TRIGGER>"+code+"</TRIGGER>");
  *      //byte[] bufferOut = Encoding.ASCII.GetBytes(code);
  *      byte[] bufferOut = Encoding.UTF8.GetBytes(code);
  *      Debug.Log("Sending " + bufferOut[0] + " (string) " + code + "\n");
  *      //socket.BeginSend(bufferOut, 0, bufferOut.Length, SocketFlags.None, new AsyncCallback (OnSend), this);
  *      socket.BeginSend(bufferOut, 0, 1, SocketFlags.None, new AsyncCallback (OnSend), this);
  * }*/
 void BeginSend(byte[] code)
 {
     Debug.Log("Sending " + System.Text.Encoding.UTF8.GetString(code) + " (byte[])\n");
     socket.BeginSend(code, 0, code.Length, SocketFlags.None, new AsyncCallback(OnSend), this);
 }
예제 #2
0
 public void Send(string data)
 {
     Data   = data;
     buffer = Encoding.Default.GetBytes(Data);
     client_socket.BeginSend(buffer, 0, buffer.Length, SocketFlags.None, Send_Callback, null);
 }