Thread: Wireless Network Linux & C Testbed

  1. #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

  2. #2
    Making mistakes
    Join Date
    Dec 2008
    Posts
    476
    Maybe post it into the Network or Linux programming forums?

  3. #3
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    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.

    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.

  4. #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

Popular pages Recent additions subscribe to a feed

Similar Threads

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

Tags for this Thread