public void Run () { SpTypeManager server_tm = SpTypeManager.Import (server_proto); server = SpRpc.Create (server_tm, "package"); client = SpRpc.Create (client_proto, "package"); client.Attach (server_tm); TestFoobar (); TestFoo (); TestBar (); TestBlackhole (); }
public void Run() { SpTypeManager server_tm = SpTypeManager.Import(server_proto); server = SpRpc.Create(server_tm, "package"); client = SpRpc.Create(client_proto, "package"); client.Attach(server_tm); TestFoobar(); TestFoo(); TestBar(); TestBlackhole(); }
public void Run () { IPAddress ip = IPAddress.Parse ("127.0.0.1"); mSocket.Connect(new IPEndPoint(ip, 8888)); mRpc = SpRpc.Create (s2c, "package"); mRpc.Attach (c2s); Send ("handshake", null); Send ("set", new SpObject (SpObject.ArgType.Table, "what", "hello", "value", "world")); mSocket.BeginReceive (mRecvBuffer, 0, mRecvBuffer.Length, SocketFlags.None, new AsyncCallback(ReadCallback), this); }
public void Run() { IPAddress ip = IPAddress.Parse("127.0.0.1"); mSocket.Connect(new IPEndPoint(ip, 8888)); mRpc = SpRpc.Create(s2c, "package"); mRpc.Attach(c2s); Send("handshake", null); Send("set", new SpObject(SpObject.ArgType.Table, "what", "hello", "value", "world")); mSocket.BeginReceive(mRecvBuffer, 0, mRecvBuffer.Length, SocketFlags.None, new AsyncCallback(ReadCallback), this); }
public bool Start(string serverIP, short port, string packageName, string s2c, string c2s) { bool result = true; try { mSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPAddress ipAddress = IPAddress.Parse(serverIP); IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, port); mSocket.ReceiveBufferSize = MAX_BUFFER_SIZE; mSocket.NoDelay = true; mSocket.BeginConnect(ipEndPoint, new AsyncCallback(ConnectCallback), mSocket); if (mConnTimeoutEvent.WaitOne(MAX_CONNECT_TIME, false)) { if (mSocket.Connected) { mRpc = SpRpc.Create(s2c, packageName); mRpc.Attach(c2s); mSocket.BeginReceive(mReceiveBuffer, 0, mReceiveBuffer.Length, SocketFlags.None, new AsyncCallback(ReceiveCallback), this); } } else { // Block time out and do not recevie any signal DebugHelper.Log("Block time out and do not recevie any signal"); } } catch (Exception ex) { DebugHelper.Log(ex.ToString()); result = false; } return(result); }
public bool Start(string serverIP, short port, string packageName, string s2c, string c2s) { bool result = true; try { mSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPAddress ipAddress = IPAddress.Parse(serverIP); IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, port); mSocket.ReceiveBufferSize = MAX_BUFFER_SIZE; mSocket.NoDelay = true; mSocket.BeginConnect(ipEndPoint, new AsyncCallback(ConnectCallback), mSocket); if (mConnTimeoutEvent.WaitOne(MAX_CONNECT_TIME, false)) { if (mSocket.Connected) { mRpc = SpRpc.Create(s2c, packageName); mRpc.Attach(c2s); mSocket.BeginReceive(mReceiveBuffer, 0, mReceiveBuffer.Length, SocketFlags.None, new AsyncCallback(ReceiveCallback), this); } } else { // Block time out and do not recevie any signal DebugHelper.Log("Block time out and do not recevie any signal"); } } catch(Exception ex) { DebugHelper.Log(ex.ToString()); result = false; } return result; }
public void Run () { mRpc = SpRpc.Create (s2c, "package"); mRpc.Attach (c2s); Send ("handshake", null); Send ("set", new SpObject (SpObject.ArgType.Table, "what", "hello", "value", "world")); mSocket.BeginReceive (mRecvBuffer, 0, mRecvBuffer.Length, SocketFlags.None, new AsyncCallback(ReadCallback), this); }