Coder Social home page Coder Social logo

messagequeues's Introduction

messagequeues

System V IPC Queues X11/Motif Example

Introduction

This repository contains a simplified example on message Queues. It uses System V IPC as message queues and Motif as X11 Toolkit. It is not intended as a ready to use library but as a basic example on how to use SysV queues.

Compilation

Requieres Motif and X11 development libraries. File /etc/xbus is used for ftok

# touch /etc/xbus
$ make xbus
$ make xclient

Usage

Clients allow registering against the bus and sending messages. Bus reads client register requests and distributes to all registered clients the messages. Below image shows one bus and four clients launched. Notice how the fourth client did not get registered and hence it is not receiving the messages.

Screenshot

Caveats

This repository is just a basic example and it lacks certain functionality:

  • Deregistration of clients.
  • Timeouts/Keepalive messages.
  • Proper termination of queues.

Additionally Andrew from #FreeBSD at Freenode correctly pointed out some issues:

  • There is no need to open one queue per client in the bus process, as mtype value could be used to identify destination client. Hence all clients and bus would share the same queue. The bus would send as many messages as clients are using mtype as destination.
  • ftok takes only the 8 least significant bits from proj_id to generate the queue key, in the current implementation it would not be that unlikely to get collisions on the lowest byte of the PID, as PIDs are used as proj_id.
  • There is at least one bug in the FreeBSD kernel which deals key_t as int instead of as long. Apparently that is affecting ipcs but not code written in C.

messagequeues's People

Contributors

marioemmanuel 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.