Pages: [1]   Go Down
Author Topic: Ethernet Server and QTcpSocket  (Read 648 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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:
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é
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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é
Logged

Pages: [1]   Go Up
Jump to: