Results 1 to 6 of 6

Thread: Socket programming

  1. #1

    Default Socket programming

    Can anyone tell me how we can handle reading from the socket buffer in an efficient way. Right now I'm just reading sequentially one after the next message and proceed, but it has limitations when it comes to high volume. And this for full time connected socket. I'm thinking of something like parallel reading from the socket buffer using several threads, but I'm not quite sure about this solution. Pls tell me if you guys have a better solution/idea for this.

    Thanx in Advance..!

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Socket programming

    Multiple threads alone is not a solution here, a more effective solution will be use multiple sockets (multiple connections).

    Multiple threads with multiple sockets my also be effective, it depends on your application.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3

    Default Re: Socket programming

    Thanx for your reply Santosh.!

    I already have the single socket with multi-threaded solution to read from the socket and serve to the requests. But I'm asking this question because that solution has limitations. Coz even it's multi-threaded the reading part from the socket is happening sequentially. For that do you have any solutions to improve the efficiency?

    Thanx in Advance.!

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

    Default Re: Socket programming

    Quote Originally Posted by isharasjc View Post
    Can anyone tell me how we can handle reading from the socket buffer in an efficient way. Right now I'm just reading sequentially one after the next message and proceed, but it has limitations when it comes to high volume. And this for full time connected socket. I'm thinking of something like parallel reading from the socket buffer using several threads, but I'm not quite sure about this solution. Pls tell me if you guys have a better solution/idea for this.
    What volume are we talking about here? Several gigabytes per second?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5

    Default Re: Socket programming

    Thanx wysota.

    I'm talking about few Megabytes(like 100 - 200MB) here. Actually I want to read it within few milliseconds or less.

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

    Default Re: Socket programming

    Quote Originally Posted by isharasjc View Post
    I'm talking about few Megabytes(like 100 - 200MB) here.
    In what time period? 100MB is 800Mb.

    Actually I want to read it within few milliseconds or less.
    How fast is your NIC? How fast is the link? Is it full duplex or half duplex?

    Transfering 800Mb in few miliseconds would require you to have a link of 100Gbps or more, do you have one? Is it some extra new space technology nobody is aware of yet?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. socket programming
    By Arpitgarg in forum Newbie
    Replies: 13
    Last Post: 21st April 2011, 09:25
  2. Socket programming, please help me!
    By nthung in forum Qt Programming
    Replies: 21
    Last Post: 26th May 2010, 23:01
  3. Can any One help me? - Socket Programming?
    By vinod in forum Qt Programming
    Replies: 6
    Last Post: 18th November 2009, 09:46
  4. Network Socket Programming
    By Walsi in forum Newbie
    Replies: 4
    Last Post: 19th June 2007, 10:04
  5. Problems in socket programming
    By vinod in forum Qt Programming
    Replies: 1
    Last Post: 7th March 2006, 08:09

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.