Server in Qt  to receive TCP/IP data from devices.

Posted on 2011-05-03
Last Modified: 2012-05-11

I'm new to Qt and I would like to ask you a suggestion.  I would like to create server application which receives data from RFID readers and stores the data in Sql Server. For example if I use this example as a reference it will be ok or maybe you could suggest better tutorial.

Server should be able to receive data from more then 1000 readers, and should be able to store all records to database. Rfid sends data packets to server using TCP/IP.  Data is send, when Reader reads the data, after that connection is terminated until new data will be sent.

Question by:Tydix123
    LVL 7

    Expert Comment

    HI there,
    Tell me one thing, Why you are terminating the TCP connection once data has been received by server?
    is the data has been send by one device only once?
    Because every time you create a TCP connection will be costly in terms of performance.
    The example you are refering to is good enough to give you an idea how you should implement it but I wrote simple client server example and application long time back, Have look of this this may help you.

    Author Comment

    hi, Maybe i have confused you, device will terminate by it self. I have loked at your example, but i thik I need threaded communication, becouse i wil need to inest data to sql server.
    LVL 7

    Accepted Solution

    Yes you need to have a tread to process the data,
    The example simply gives you an idea how you can implement client server.
    So you need to have one thread which will keep waiting for any incoming connection, once gets connected read the date hand over to another Process Thread and and again keep waiting for another thread.

    You are going in excellent direction Tydix123: This is how any of such problem gets solved. May be you can use mutex just for the PocessThread which inserts the data in DB.

    Best of Luck

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Article by: SunnyDark
    This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
    Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
    The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
    The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now