Skip to content

wjnlim/msg_pass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

msg_pass — Asynchronous Message-Passing Library

A lightweight asynchronous message-passing library written in C.

Overview

This library provides a minimal asynchronous server–client messaging model based on non-blocking sockets and an event-driven architecture.

Messages follow a line-based protocol.

The implementation is intentionally small and is intended for an experimental distributed system rather than general-purpose messaging infrastructure.

Design Context

This library was originally developed as the communication layer for the Direct-Access MapReduce prototype.

In that system, it is used for master–worker coordination such as task assignment and control messaging.

Although developed for that system, the library can also be used in other server–client applications.

Message Handling Model

Communication is driven by an event engine, with callbacks invoked when I/O events occur.

Messages follow a line-based protocol.
A message is considered complete when a newline character (\n) is received.

Server

  • Accepts client connections
  • Invokes a request-handling callback whenever a message is received
  • The handler may optionally send a reply to the client

Client

  • Sends requests to the server
  • Receives replies asynchronously through an on-reply callback (on_completion_cb)

Notes

This library is intended for experimental use and does not aim to provide production-level messaging features.
Error handling and edge-case coverage are intentionally minimal.

Dependencies:

The CMake configuration automatically fetches the dependencies.

Build and Installation

# 1. Clone the repository
git clone https://github.com/wjnlim/msg_pass.git

# 2. Create a build directory
mkdir msg_pass/build
cd msg_pass/build

# 3. Configure with CMake
cmake -DCMAKE_INSTALL_PREFIX=<your install directory> ..

# 4. Build and install the library
cmake --build . --target install

Example Programs

Example programs are available in the repository:

Compile example server:

# hello_server
gcc hello_server.c -o hello_server -I <your install directory>/include/ <your install directory>/lib/libmsg_pass.a -lpthread

Compile example client:

# hello_client
gcc hello_client.c -o hello_client -I <your install directory>/include/ <your install directory>/lib/libmsg_pass.a -lpthread

Run example:

# start server
./hello_server

# run client
./hello_client <server ip> <client name> <use_threadpool> <number_of_requests>

Using the Library

To compile your program using this library:

gcc your_prog.c -o your_prog -I <your install directory>/include \
  <your install directory>/lib/libep_engine.a -lpthread

About

A lightweight asynchronous message-passing library in C for event-driven server–client communication.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors