Thread: C++ non blocking tcp server for linux help

  1. #1
    Registered User bremenpl's Avatar
    Join Date
    Apr 2013
    Posts
    57

    C++ non blocking tcp server for linux help

    Hello there,
    I have some experience in linux c programming with sockets. The problem is, all my little apps I have wrote (even the ones using threads) were consuming a lot of processor time, as the listen/ response system was always implemented in a loop.

    Now, I have to implement a tcp server on a BeagleBone black, that will send and receive data from the client connected to it. The platform doesnt have much resources. I was wondering, either it is possible to implement a c++ tcp server without that consumptive big while and for example use callbacks or poxis functions? I Dont have experience in that, I tried to look around on the internet, but all the examples I found were either in a while(1) or to complex for my application and fast understanding.

    I was wondering either any user of the forum could give me some hints, code examples or maybe links to tutorial that utilises the use of sockets with threading and callbacks/ posix? I am used to more low level programming with microcontrollers, where event driven situations can be easilly handled by interrupts. In this application, I would also like not to poll for the incoming data.
    I would really aprichiate all help in this matter!

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    look at boost::asio.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  3. #3
    Registered User bremenpl's Avatar
    Join Date
    Apr 2013
    Posts
    57
    Ill try finding tutorials on that, thank you.

  4. #4
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    If you find asio too difficult, look at Poco.
    http://pocoproject.org/slides/200-Network.pdf

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C TCP Server Linux
    By subrat17 in forum Networking/Device Communication
    Replies: 4
    Last Post: 07-16-2014, 05:47 PM
  2. Pros and Cons of blocking versus non-blocking sockets?
    By abachler in forum Networking/Device Communication
    Replies: 4
    Last Post: 05-08-2008, 06:52 AM
  3. Non-Blocking Server help.
    By unkownname in forum Networking/Device Communication
    Replies: 7
    Last Post: 07-27-2007, 05:04 PM
  4. Simple client - receiving data from server and keyboard w/o blocking
    By Spitball in forum Networking/Device Communication
    Replies: 5
    Last Post: 01-08-2005, 12:32 PM
  5. Blocking a server with hosts.
    By adrianxw in forum Tech Board
    Replies: 4
    Last Post: 03-14-2003, 12:14 AM

Tags for this Thread