void SendToClients(string msg, List <ConnectionObject> clients, ServerOnSendCallback cb) { foreach (ConnectionObject co in clients) { ch.BeginSend(co, msg, cb); } }
public void BeginSend(ConnectionObject co, String message, ServerOnSendCallback cb) { byte[] byteData = Encoding.ASCII.GetBytes(message); if (byteData.Length > ConnectionObject.BufferSize) { Debug.LogWarning("Message length is larger then max buffer size"); } ServerSendObject sso = new ServerSendObject(co, cb); co.socket.BeginSend(byteData, 0, byteData.Length, 0, new AsyncCallback(SendCallback), sso); }
public ServerSendObject(ConnectionObject co, ServerOnSendCallback cb) { this.co = co; this.cb = cb; }
void SendToAllClients(string msg, ServerOnSendCallback cb) { SendToClients(msg, GetAllConnectedClients(), cb); }