Results 1 to 7 of 7

Thread: QTcpServer not reading as fast a QTcpSocket writing.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QTcpServer not reading as fast a QTcpSocket writing.

    Quote Originally Posted by quickNitin
    Hello everybody,
    i have a strange pbm here. I have QTcpServer Which do listening accepting new connections putting data on dialog level. I have fortune client type code which transfers the data to server.
    I have few problems here.Major problem is QTcpServer is not reading as fastly as client is writing.
    In what way it is not reading as fast as the client is writing? What happens? Are the client and the server running on different machines? Are the machines on a local network or do they communicate through the Internet?


    i need guidance on one more issue, Say multiple clients get connected to socket. How i will diffrentiate between the data which i receives from various sockets.
    i think above code can cater to multiple clients.
    When a client connects to the server, it is given a separate socket on the server side. So you can differenciate clients easily because they are using different sockets.

    This line of code does the job:
    Qt Code:
    1. tcpSocket=tcpServer->nextPendingConnection();
    To copy to clipboard, switch view to plain text mode 

    Each client will get its own "tcpSocket".

  2. #2
    Join Date
    Apr 2006
    Posts
    122
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    18

    Default Re: QTcpServer not reading as fast a QTcpSocket writing.

    They both are is on same machine.
    client program is writing to the socket every 1 second at regular intervals.
    Reading function/slot of server is connected to signal readyRead(). I expect as soon as client write to socket server should be able to detect its presence but it is not happening. Server is lagging behind around by two third of data client writes.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QTcpServer not reading as fast a QTcpSocket writing.

    Do you have more than one processor in your computer?

  4. #4
    Join Date
    Apr 2006
    Posts
    122
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    18

    Default Re: QTcpServer not reading as fast a QTcpSocket writing.

    NO it is a uniprocessor p4 machine.
    Als o itried something else. In above posted client code , i am writing twice simultaneously to the socket( line 15). I changed this. I made a string of both x and y and write it socket. Now this is working fine. But i still has not got reason for previous behaviour.
    Last edited by quickNitin; 4th July 2006 at 06:33. Reason: addition

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QTcpServer not reading as fast a QTcpSocket writing.

    Quote Originally Posted by quickNitin
    NO it is a uniprocessor p4 machine.
    So how do you expect two processes to be executed simoultaneously? There will always be delays between different processes, because they get different time shares of the CPU.

  6. The following user says thank you to wysota for this useful post:

    quickNitin (4th July 2006)

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
  •  
Qt is a trademark of The Qt Company.