Go Down

Topic: Ethernet Server and QTcpSocket (Read 697 times) previous topic - next topic

Hervé

Hello,

I'm trying to connect to my Arduino card via an C++/Qt application using QTcpSocket but I don't manage to connect.

Code: [Select]

void setup()
{
  Ethernet.begin(mac,ip);
  server.begin();
  Serial.begin(9600);
}

void loop()
{
   Client client = server.available();
   if(client){
      Serial.print("host connected");
   }
}


Address and port for my Arduino are 192.168.200.231:10000

So my Qt code is just:

Code: [Select]
QTcpSocket sock;
...
sock->connectToHost(QHostAddress("192.168.200.231"),10000);
...


My application find well the host with signal "Host Found" but stay stucked after.
When I recall the same code, I have a message that notifies that it is already looking up or connecting/connected to the host.
But in my Arduino console, the message "host connected" never appears.

Am I doing something wrong ? Is it possible to use QTcpSocket to connect to the simple Ethernet Server ?

Thank you

Hervé

Hervé

It don't know what I've done but it seems to work well now.
I just tried on port 80 and it worked, and now, on port 10000 it work too...

Maybe the port 10000 was used and locked by an other application when I began.
Sorry for this question that was not a really one.

Hervé

Go Up