public bool SendData(byte[] data) { if (Connected) { return(m_SocketConn.SendData(data)); } else { return(false); } }
private void ThreadTask() { try { while (!m_Terminate) { if (m_WaitingRemainingBytes != DateTime.MinValue) { if (DateTime.Now.Subtract(m_WaitingRemainingBytes).TotalSeconds > 2) { Trace(EventType.Error, string.Format("{0} - So long time waiting the rest of message bytes. The connection will be closed. {1}", LOG_TAG, m_ScktConn.RemoteEndPoint)); Close(); } } lock (m_SendMsgList) if (m_SendMsgList.Count > 0) { byte[] msgBytes = m_SendMsgList[0]; m_ScktConn.SendData(msgBytes); Trace(EventType.Full, string.Format("{0} - {1} bytes sent !!!", LOG_TAG, msgBytes.Length)); m_SendMsgList.RemoveAt(0); } if (!m_Terminate) { if (!m_ThreadResetEvent.WaitOne(2000) && m_SendMsgList.Count == 0) { CommandEtherNetIPHeader msgListServices = new CommandEtherNetIPHeader { Command = EncapsulationCommands.NOP }; SendMessage(msgListServices, null); } } } } catch (Exception exc) { Trace(exc); } }
public bool SendData(SocketConn scktConn, byte[] data) { return(scktConn.SendData(data)); }