public void SendMessage <T>(T m) { string s = typeof(T).FullName; int t; bool b = cdict.TryGetValue(s, out t); if (b) { Stream str = new MemoryStream(); Serializer.Serialize <T>(str, m); string tname = typeof(T).Name; switch (tname[0]) { case 'C': socketManager.SendProtoMessage(SocketId.Main, t, str); break; case 'R': socketManager.SendProtoMessage(SocketId.Chat, t, str); break; default: break; } HDebugger.Log(HDebuggerModule.Proto, "SendMessage all network log : C --> S : " + s); } }
public void SendMessageEmpty <T>() { string s = typeof(T).FullName; int t; bool b = cdict.TryGetValue(s, out t); if (b) { string tname = typeof(T).Name; switch (tname[0]) { case 'C': socketManager.SendEmptyMessage(SocketId.Main, t); HDebugger.Log(HDebuggerModule.Proto, "C --> S : " + s); break; case 'R': socketManager.SendEmptyMessage(SocketId.Chat, t); break; default: break; } } }
public void SendMessage <T>(SocketId socketId, T m) { string s = typeof(T).FullName; int t; bool b = cdict.TryGetValue(s, out t); if (b) { Stream str = new MemoryStream(); Serializer.Serialize <T>(str, m); string tname = typeof(T).Name; socketManager.SendProtoMessage(socketId, t, str); HDebugger.Log(HDebuggerModule.Proto, "SendMessage network log : C --> S : " + s); } }
protected bool Send(byte[] buffer, int offset, int size) { if (socket.Connected) { SocketError sr; int i = socket.Send(buffer, offset, size, SocketFlags.None, out sr); if (i == -1 || sr != SocketError.Success) { HDebugger.Log(HDebuggerModule.Proto, sr.ToString()); Reconnect(); return(false); } return(true); } return(false); }