Example #1
0
void ByteArray::setString(const char *str)
{
	int len = str ? (int)strlen(str) : 0;
	if (len)
	{		
		requestNewData(len);

		memcpy(m_data, str, len);
		m_data[len] = '\0';
		m_stringLength = len;
	}
	else
	{
		empty();
	}
}
Example #2
0
void ByteArray::append(const char* str, int index, int count)
{
	if (count) 
	{
		if (m_stringLength)
		{
			requestMoreData(m_stringLength + count);
		}
		else
		{
			requestNewData(count);			
		}

		memcpy(m_data + m_stringLength, str + index, count);
		
		m_stringLength += count;
		m_data[m_stringLength] = 0;
	}
}
Example #3
0
Hostname::Hostname(QWidget *parent, QString ihost, QString iport) :
    QDialog(parent), networkSession(0)
//    ui(new Ui::Hostname)
{
  //  ui->
    defaultport="23000";
    host=ihost;
    port=iport;
    setupUi(this);
    this->lineEditHostname->setText(host);
    this->lineEditHostport->setText(port);
    this->pushButtonDefaultPort->setText(tr("Default port ")+defaultport);
    tcpSocket = new QTcpSocket(this);
    connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(readPort()));
    connect(tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)),this, SLOT(displayError(QAbstractSocket::SocketError)));

    QObject::connect(this->pushButtonDefaultPort,SIGNAL(clicked()),this,SLOT(setDefaultPort()));
    QObject::connect(this->pushButtonGetData,SIGNAL(clicked()),this,SLOT(requestNewData()));

}