Results 1 to 2 of 2

Thread: QTcpSocket not connecting to ARM tcp serwer

  1. #1
    Join Date
    Oct 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QTcpSocket not connecting to ARM tcp serwer

    After saying 'hello' this post is my second on QT Centre Forum. Anybody quess, that I have problem

    So. I have a project to do. My project is related to sound aquisition and processing. I decided to gather sound via ARM processor send samples through Ethernet to x86 computer and there to process it.

    Part related to ARM is done. Moreover some part of x86 is drafted in MS Visual Studio 2005. And is working fine (as you can see at adc.jpg file).

    Problem raised when I tried to rewrite connection into QT.
    Below Windows working code:

    Qt Code:
    1. System::Void m_buttonConnect_Click(System::Object^ sender, System::EventArgs^ e)
    2. {
    3. if (m_connectionSocket==nullptr || !m_connectionSocket->Connected)
    4. {
    5. System::Net::IPEndPoint ^ endpoint = gcnew System::Net::IPEndPoint(System::Net::IPAddress::Parse("192.168.1.5"),40000);
    6.  
    7. try
    8. {
    9. m_connectionSocket = gcnew Socket(AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp);
    10. m_connectionSocket->Connect(endpoint);
    11. }
    12. catch (Exception ^ e)
    13. {
    14. System::Windows::Forms::MessageBox::Show(e->Message,"Connecting error",MessageBoxButtons::OK,MessageBoxIcon::Error);
    15. return;
    16. }
    17.  
    18. m_labelStatus->Text = "Connected";
    19. }
    20. }
    To copy to clipboard, switch view to plain text mode 

    And the second - my first steps in network connections in QT:

    Qt Code:
    1. void trakkermodel::setConnection(){
    2. QTcpSocket qsoket;
    3.  
    4. qsoket.connectToHost("192.168.1.5",40000);
    5.  
    6. if (qsoket.isOpen()){
    7. qDebug("qsoket is open");
    8. }
    9.  
    10. if (qsoket.waitForConnected(5000)==false){
    11. emit sigSetStatus("Failed to connect qsoket",2000);
    12. qDebug("Failed to connect inside setConnection\n");
    13. //printf("Failed to connect\n");
    14. }else{
    15. emit sigSetStatus("qsoket connection estabilished sucessfully",2000);
    16. }
    17. }
    To copy to clipboard, switch view to plain text mode 

    I get delirium when I see text "Failed to connect inside setConnection"

    Moreover - in QT Creator I cannot take any glimpse on qsoket's values. Is it correct?

    On request I will paste next codes, but I wont to generate noise. So if you find such step useful - please write.
    Attached Images Attached Images

  2. #2
    Join Date
    Oct 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTcpSocket not connecting to ARM tcp serwer

    Problem solved.

    In windows i had default address 192.168.1.1. In linux IPv4 was not set at all. After setting proper address of eth0 QTcpSocket connects to host.

    I generate problems which are not trivial

Similar Threads

  1. QTcpSocket proxy authentication problem
    By arbi in forum Qt Programming
    Replies: 3
    Last Post: 14th September 2009, 17:43
  2. Challenging QTcpSocket reliability problem
    By Raccoon29 in forum Qt Programming
    Replies: 3
    Last Post: 13th January 2009, 11:38
  3. array of pointers to QtcpSocket
    By gQt in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 16th June 2008, 10:15
  4. Strange QTcpSocket behavior (debugged with Ethereal)
    By mdecandia in forum Qt Programming
    Replies: 23
    Last Post: 28th May 2007, 21:44
  5. QTCPSocket not connecting
    By DPinLV in forum Qt Programming
    Replies: 6
    Last Post: 25th August 2006, 08:18

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.