sending Text or binary file over network
hi
how can i send text string or a block of binary numbers over a LAN to another computer so that i can receive it there and display the data i send. I tried QSocket but it din't work. Here is the Code :
Code:
void transmitter::dothis()
{
QVector<QRadioButton*> rButtonContainer;
rButtonContainer.push_back(radioButton_1);
rButtonContainer.push_back(radioButton_2);
rButtonContainer.push_back(radioButton_3);
rButtonContainer.push_back(radioButton_4);
rButtonContainer.push_back(radioButton_5);
rButtonContainer.push_back(radioButton_6);
for(int i=0; i <rButtonContainer.size(); ++i)
{
if(rButtonContainer[i]->isChecked())
{
str+=rButtonContainer[i]->text();
}
block.append(inputLine->text() );
socket->write(block);
}
}
I have to send the Label of the RadioButton which is checked over the Network to another computer. Which i am not able to. ?? !!
What is the code the receive slot should have to receive and display the data sent from the transmitter. ?? Pls get me out of this prob.
Thank you
Re: sending Text or binary file over network
There is already an example of this in the Qt4 documentation. Also, QTCPSocket is used in place of QSocket in qt4.
Have a look here: http://doc.trolltech.com/latest/qtcpsocket.html
There are some examples like the Fortune Client. Just modify some parts of it to make them work with your situation.