Send() 공개 정적인 메소드

public static Send ( UOJS.WebSocketClient client, byte data, RequestType type, bool mask ) : void
client UOJS.WebSocketClient
data byte
type RequestType
mask bool
리턴 void
예제 #1
0
파일: GameProxy.cs 프로젝트: nydehi/uojs
        public static void OnReceiveFromWebSocket(WebSocketClient client, byte[] data, int length)
        {
            try {
                switch ((char)data [0])
                {
                // Reconnect
                case 'R':
                {
                    if (client.UOSocket != null && client.UOSocket.Connected)
                    {
                        client.UOSocket.Close();
                    }
                    goto case 'C';
                }

                // Connect
                case 'C':
                {
                    string[] strData = Encoding.ASCII.GetString(data, 0, data.Length).Split(' ');
                    for (int i = 0; i < strData.Length; i++)
                    {
                        Console.Write(strData [i] + ",");
                    }
                    client.UOSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                    Console.WriteLine(string.Join(",", strData));
                    client.UOSocket.BeginConnect(strData [1], int.Parse(strData [2]), new AsyncCallback(UOConnectCallback), client);
                    break;
                }

                // Version
                case 'V':
                {
                    GameProxy.Send(client, "Version {0}", UOJS.Version);
                    break;
                }


                default:
                {
                    client.UOSocket.BeginSend(data, 0, data.Length, SocketFlags.None, new AsyncCallback(UOSendCallback), client);
                    break;
                }
                }
            } catch (Exception e) {
                UOJS.Log("Client [d/c]: Threw {0}... closing!", e.GetType());
                UOJS.Log(e.StackTrace);
                client.Close();
            }
        }
예제 #2
0
파일: GameProxy.cs 프로젝트: nydehi/uojs
 public static void Send(WebSocketClient client, string format, params object[] o)
 {
     GameProxy.Send(client, m_Encoding.GetBytes(string.Format(format, o)), RequestType.WebRequest, false);
 }