View Full Version : TCP/IP interrupts || MAC address || Client-Server relationship || Arranging packets

27th January 2010, 18:41
Hi, guys. :)

First post here so I hope I didn't put this in the wrong section of the forum. Before starting with what I need to do and what's what, I'd like to ask you not to use some freakish terminology, because I'm new to Qt (yet not a total newbie). The questions below are not in any particular order.

Now let's start with the thing I'm doing. I'm working on a school-project and have a pressure sensor that is connected to some kind of a signal converter that actually does all the low-level transformations of the signals coming from the sensor and sends all the data via TCP/IP. Now I've programmed sensors before but using C, interrupts and low-level programming. But never done something like this in Qt and what's more - using TCP or whatever. Sooo...

First question: is it possible to collect data via interrupts from a certain device via TCP/IP. I've seen this but with Java. If someone can give me some rough guideline or even an example, it'll be greatly appreciated.

The next question is the following. The computer I'm using has 2 network cards. I seem not to be able to find any information about how to retrieve the MAC address of each network card and use one by choice that is - program detects X network cards (via MAC addresses) and gives the user the opportunity to choose which card to use (and the corresponding ports of course), so that the first network card can be used to receive the data from the sensor and using the program display it on the screen and at the same time the other card can be used to do something else (playing some pocker online :D).

Third question is about the client-server relationship between the sensor and the program I'm writing. I still can't quite figure out what should play as server and what - as client. Both sides send and recieve. The program receives numbers (the pressure applied on the sensor) but and the same time using buttons the user can send kill-signal, reset-signal etc. The sensor sends numbers but also receives singals (hexadecimal numbers) from the program. I think that the program should be the client (especially if you want to start it on more than one PCs and receive data from one sensor) and the senor should be the server. But probably that's all nonsense. :D

Forth and last: the sensor has tree pressure points. Each of them send data (say Fx, Fy, Fz). When I make my program how can I distinguish which number (applied pressure) came first, second and third? Can I put the whole data in one packet looking like this -> [Fx, Fy, Fz] and so that I can tell my program to look the first part [here - Fx] and put it inside field A on the GUI, than look the second [Fy] and put it inside B, and finally look at the third [Fz] and put it inside field C (these fields will show the exact pressure using numbers).

Hope you understand what I mean.
Thank you very much for sparing some time with my problems. :)

28th January 2010, 07:21
Take a look at tcpserver and tcpsocket.
You don't have to know anything about mac-addresses because connections are made based on ip-address.
The answer to the rest of your questions can be found in the docs and Qt-examples.

28th January 2010, 07:26
Thanks. Will keep looking. :D