C Board  

Go Back   C Board > General Programming Boards > Networking/Device Communication

Reply
 
LinkBack Thread Tools Display Modes
Old 06-08-2009, 09:29 AM   #1
Registered User
 
Join Date: Jun 2009
Posts: 4
Wireless Network Linux & C Testbed

Hi all,

I am writing a linux testbed for wireless sensor networks. The core objective is to test data transfer between any two nodes. The network runs using tree topology.
One node in the network is the "Driver". This node is connected using serial port to a linux PC. What I am trying to write is the software on this linux PC that will drive data transfer in the network.

The "Driver" node, taking commands from the software running on linux PC, will send out data request message to a Sender node. The Sender node will parse the data request message and commence data transfer to the "Driver". Multiple such Senders can exist. All data transfers is from the Senders to the "Driver" node. The "Driver" node passes all the data it receives to the linux application. The linux application keeps track of how many packets have been received from the different Senders.

Following are the requirements.

1. Any node in the network can be the driver (destination) and any node can be the Sender.
2. There can be multiple Senders at any give time, sending data to the "Driver" node.
3. The data received from serial port and sent by serial port by the linux application are logged to a file.
4. The linux application should be able to read data request messages from a file and send them out at specified times.
5. A GUI for this linux application. All the code with be in C, so the GUI choice will have to place nice with C.

One final twist: the data from Sender to "Driver" is fragmented data. On the Sender side fragmentation is handled in the device itself. On the "Driver" side fragmentation will be handled in the linux application. So the linux application will have to keep track of the fragmentation window and send fragment ack for each of the data transfer going on with the multiple senders, and keep track of the number of packets received so far from each Sender.

So in the linux application, is the way to go having multiple threads - one thread for each Sender? Will multiple threads play nice with one serial port for
sending and receiving simultaneously?

Advise on any requirement will be appreciated. The basic idea is to test data transfer, especially data gathering(several nodes sending data to one node) . If a different approach than outlined above is suggested I am more than welcome to hear them too.

Thanks a bunch

James
james457 is offline   Reply With Quote
Old 06-08-2009, 09:51 AM   #2
Making mistakes
 
Join Date: Dec 2008
Posts: 347
Maybe post it into the Network or Linux programming forums?
__________________
Look at this: Community Project
And this: Ascent - Programmer needed
Brafil is offline   Reply With Quote
Old 06-08-2009, 10:06 AM   #3
Registered User
 
Join Date: Sep 2004
Location: California
Posts: 2,845
Quote:
Will multiple threads play nice with one serial port for
sending and receiving simultaneously?
Only if you synchronize access around the use of the serial port. In general, threads never play nice with each other when it comes to sharing a resource. It is up to you as the programmer to ensure that only one thread can access the resource at a time. In this case though, I don't see why you need threads at all. Isn't each sender on a separate node? Maybe I don't fully understand your use case.

Quote:
A GUI for this linux application. All the code with be in C, so the GUI choice will have to place nice with C.
Use GTK.
bithub is offline   Reply With Quote
Old 06-11-2009, 11:03 AM   #4
Registered User
 
Join Date: Jun 2009
Posts: 4
Quote:
Originally Posted by bithub View Post
Only if you synchronize access around the use of the serial port. In general, threads never play nice with each other when it comes to sharing a resource. It is up to you as the programmer to ensure that only one thread can access the resource at a time. In this case though, I don't see why you need threads at all. Isn't each sender on a separate node? Maybe I don't fully understand your use case.

Use GTK.
I am thinking of a slightly different requirement. I want to run all the nodes on a single PC. The software should drive the entire network. The network will have multiple Drivers and Senders. A node cannot be Driver and Sender at same time though. A Sender will only talk to one Driver at a time.

I am thinking of having one process that reads data from all serial ports. I think I can go with select() for non blocking I/O and read/write from/to several serial ports.

Now how do I run each driver? Is it better to have each driver as a process or a thread?

Any other different architecture in mind for this new requirement?

Thanks
james457 is offline   Reply With Quote
Reply

Tags
c programming, linux, multithreading, network programming, testing

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
accessing files over wireless network BobMcGee123 Tech Board 4 07-29-2006 02:25 PM
Linux Network Programming (server architeture) curlious Networking/Device Communication 3 01-08-2005 05:16 PM
Wireless network question dirkduck Tech Board 1 12-26-2002 04:56 PM
Linux Network Programing Unregistered Linux Programming 2 07-27-2002 06:08 AM


All times are GMT -6. The time now is 09:28 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22