Simulating wireless netowork using IPC

This is a discussion on Simulating wireless netowork using IPC within the C Programming forums, part of the General Programming Boards category; Dear all, I am writing a tiny simulator for wireless networks in a PC(linux). The network will consist of several ...

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    1

    Simulating wireless netowork using IPC

    Dear all,

    I am writing a tiny simulator for wireless networks in a PC(linux).

    The network will consist of several nodes, and any one might send data to any other.

    I thought of named pipes, but that might make the simulator more of a wired like feel.

    In a wireless network, every packet(including unicast) is actually a broadcast with respect to the transmission medium. However only nodes within reception range will be able to receive the packet. To phrase that in IPC terms, there are several processes/threads, however data written by a particular process/thread is visible only to a subset of other processes. I should be able to control which nodes are part of this subset.

    What is the best choice IPC to do the same?

    Thanks

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Do not use pipes. All network traffic, wireless or not, takes place on sockets.

    On linux you can use local sockets, type PF_LOCAL. They are exactly the same as PF_INET sockets, only slightly simpler to configure, and they use a named file (like a FIFO). In terms of IPC, to "simulate" or actually engage a network, you must use sockets.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    30 Helens Agree neandrake's Avatar
    Join Date
    Jan 2002
    Posts
    640
    It sounds like you are trying to simulate the physical layer of wireless networks. In the simulation, you will have to simulate nodes not being visible to eachother - trying to enable that limitation in the actual IPC method would prove to be rather difficult. Use sockets (or other IPC methods), and either as part of the data sent across, or in a global map, you would have to define distance limitations. Meaning, each node would receive the data, but would have to decide if it should ignore it as it shouldn't be visible.
    Environment: OS X, GCC / G++
    Codes: Java, C#, C/C++
    AOL IM: neandrake, Email: neandrake (at) gmail (dot) com

  4. #4
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    You want to simulate the fact that all hosts can "see" every packet, even those which are not destined for that host. The problem is that packets only have a momentary existence in reality. After they have been transmitted they vanish. So you are going to have to create some kind of data structure which queues up all the packets which are "on the air" at any given moment, allows all the hosts to have access to them, then somehow free them after an appropriate amount of time.

    I suppose one way to do this would be to construct an "in flight" packet queue somewhere in shared memory. Each packet is queued into this shared area with some small lifetime. While the packet is in the buffer, a process (which simulates a host) can examine it, but it had better do it soon, because the buffer is continually getting flushed as packets expire.

    It's going to depend on how accurate a representation of reality you want.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Segmentation fault - IPC
    By kbfirebreather in forum C Programming
    Replies: 7
    Last Post: 02-01-2009, 02:17 PM
  2. Is my laptop wireless G or N..??
    By The Brain in forum Tech Board
    Replies: 2
    Last Post: 12-26-2007, 04:12 AM
  3. Upgrading my wireless
    By Dark_Phoenix in forum Tech Board
    Replies: 1
    Last Post: 04-15-2007, 09:29 AM
  4. Replies: 6
    Last Post: 08-26-2004, 12:36 AM
  5. wireless networks
    By metsman20 in forum Tech Board
    Replies: 3
    Last Post: 12-17-2003, 08:07 PM

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