Giter VIP home page Giter VIP logo

networking's Introduction

Networking Research

This repo contains demonstration programs for Linux networking.

  1. python load test harness for wifi WPA network, change the device MAC and IP to hammer an openwrt router
  2. epoll using combinations of edge/level triggers and blocking reads.

Python2 test harness

Use the pyroute2 python package to modify the IP and MAC of a wifi interface. pyroute2 uses the netlink interface.

this is a work in progress

Epoll Edge-trigger and Non-blocking Server

There is a lot of mysterious code out there related to the epoll edge-triggered feature so I decided to write a simple TCP server using epoll to test out some of the concepts. See epoll_server.c for the code.

Running the Server

Start epoll_server in one window. It will start and listen either a static port you give it or a dynamic port assigned by the kernel. Either way, the port will be written to a temp file for the clients to connect on.

Running Local Clients

Use nc (or netcat) in other windows to generate traffic to the server. These can be interleavened, along with server standard in.

nc localhost $(cat /tmp/server.port)
... enter data 
^D to exit
nc localhost $(cat /tmp/server.port) < /tmp/dumpfile.log

Edge-triggered Reads

If clients are configured for edge-triggered reads, epoll_wait will wait for only NEW data from the client. If there is un-read data from a previous stream, it will not be read. This is best illustrated by starting the server without putting the clients in non-blocking mode:

epoll_server -e

and entering some data either from stdin or nc. The (very small) buffer will be filled and written

Non-blocking Reads

If clients are configured for non-blocking reads, epoll_wait will wait for data and then it will all be read.

epoll_server -n

Summary

The edge-triggered epoll does not seem to be very helpful. If I set the clients to non-blocking and level-triggered it seems to have the same impact as edge-triggered.

However, if I set only edge-triggered epoll then it will not read the client streams correctly.

networking's People

Contributors

dturvene avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.