Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2011-05-03
3
Medium Priority
?
1,517 Views
Last Modified: 2012-05-11
Hi,

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 http://doc.trolltech.com/latest/network-threadedfortuneserver.html 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.

0
Comment
Question by:Tydix123
  • 2
3 Comments
 
LVL 7

Expert Comment

by:irfan_omair
ID: 35514930
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.
http://web.mit.edu/qt/www/clientserver-example.html
0
 

Author Comment

by:Tydix123
ID: 35515098
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.
0
 
LVL 7

Accepted Solution

by:
irfan_omair earned 1000 total points
ID: 35515140
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
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

571 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