user3852803
user3852803

Reputation: 162

UDP with mulicast sockets over wireless network

I wrote a simple udp server client application with multicast sockets. Server is sending packets to three clients every 6 ms . Packet size is 1200 bytes. This is 166,66 packets per second. Whenever one of the client detects a missing packet, it will send a NACK packet to the server via unicast .

First test: Server and three clients were connected to the router TP-Link TL-WDR4300 (dd-wrt) via ethernet and everything worked fine.

Second test: Only server was connected to the router via Ethernet and other clients were connected via wireless 2.4 GHz and with fixed channel. Two problems arrived with wireless: First problem is packet loss, clients are receiving just 50% of packets. And losses appear in bursts, for example 400 packets are received, 200 are lost etc. Second problem is that when clients are sending back NACK packets to the server which I can see on wireshark but my application can't receive them. This is strange because the code is the same as it was when clients were connected via Ethernet. So, any ideas ? I would be thankful

Server code:

while (1) {

    FD_ZERO(&readfds);
    FD_SET(sd, &readfds);

    tv.tv_sec = 0;
    tv.tv_usec = 0;

    rv = select(sd + 1, &readfds, NULL, NULL, &tv);

    while (rv == 1) {

        nack_processing(sd);
        rv = select(sd + 1, &readfds, NULL, NULL, &tv);


    }
}
return 0;

}

I also made updates to decrease traffic: Packet size : 800 bytes Inter arrival time between packets : 10 ms = 100 packets per second = 0.076 MB /s

and I measured traffic at server and client sides: Server ~ 10 MB/s Clients ~ 5 MB /s

Everything seems fine

Upvotes: 5

Views: 1339

Answers (1)

Karthik Balaguru
Karthik Balaguru

Reputation: 7832

Note that you are comparing two different interfaces/media. One is wired interface and another is wireless interface.

Packet Loss in wireless networks:

This can be due to multitude of reasons. However, the first immediate checkpoint should be SNR, RSSI and operating frequency/co-channel interference. A wifi-analyzer can almost take you near to the solution.

Wireless router location - Check whether the wireless router is centrally located within areas requiring coverage. Ensure to avoid coverage holes with proper overlapping of coverage areas. Ensure to avoid buildings in-between to reduce interference. Also, note that there is a relation between the distance and data rate for a user. The the nearer the user, the higher the data rate because of reduced path loss (because this in-turn increases the SNR).

Type of Antenna - An istropic antenna provides coverage area in the form a sphere. Dipole antenna provides coverage area in the form of doughnut. There are also various directional antennas. Beware that the omni-directional antenna can lead to hidden node problem incase of large cell size. Antenna with focused beam can be helpful. Multi-sector directional antenna can give high capacity, range. The type of antenna, its location and antenna gain determines the radio transmission range and the coverage area.

Communication channel / Operating frequency - Presence of other APs operating in the same frequency in the same radio coverage area can cause interference. In such cases, the operating channel and channel separation should be changed accordingly to reduce interference if there are only 802.11 devices nearby.

Power level - The higher power level can increase the range but if there are nearby APs, it can lead to interference. For higher capacity, APs might be close together, in such cases low power level is preferred to reduce interference.

Other devices - Interference can also be introduced by non-802.11 devices like microwave ovens, bluetooth, cordless phones etc.. In such cases, it is better to remove those devices or shield it to avoid interference.

Packet loss in terms of burst also seems to suggest that the stack is not able to handle bursty traffic and its traffic shaping policy may be to simply drop such bursty packets. Double check if such traffic burst is generated.

NACK not reaching the server : Again, this can be due to the transmission media related issues that can cause the NACK to be dropped over the air. Incase if the NACK has reached the host but not the server application/un-handled, then it can be due to the architecture of the server or stack related OS configuration.

Typical steps for analyzing packet loss scenarios

  1. Check the firewall settings, OS configurations, router configurations and network hardware capabilities/ configs(throughput capability,operation mode), intermediate node config/ capabilities(MTU, routing/forwarding table)
  2. On the wireless path, check location of AP, operating range(frequency), channel separation, SNR ,RSSI, antenna type/gain, coverage holes, distance from AP, presence of other 802.11 devices & non-802.11 devices in coverage area.
  3. Check packet statistics on all input & output points of the various nodes & interfaces
  4. Check packet statistics on all input & output points in applications/protocol layers
  5. Repeated tests to identify the pattern of the packet loss with various combinations of throughput, packet size, duration of run, different applications, different payload sizes, different number of pkts, power level, AP location, channel... is also a way to determine the area of problem.

Upvotes: 1

Related Questions