public void OnNewConnection(INetworkSocket socket) { m_socketList.Add(socket); String sendString = "** New user(" + socket.GetIPInfo().GetIPAddress() + ") connected!"; AddMsg(sendString); byte[] sendBuff = BytesFromString(sendString); foreach (var socketObj in m_socketList) { if (socketObj != socket) { socketObj.Send(new Packet(sendBuff, sendBuff.Count(), false)); } } }
public void OnReceived(INetworkSocket socket, Packet receivedPacket) { string sendString = "User(" + socket.GetIPInfo().GetIPAddress() + ") : " + StringFromByteArr(receivedPacket.GetPacket()); AddMsg(sendString); foreach (var socketObj in m_socketList) { if (socketObj != socket) { socketObj.Send(receivedPacket); } } }