Skip to content

Latest commit

 

History

History
116 lines (84 loc) · 3.14 KB

File metadata and controls

116 lines (84 loc) · 3.14 KB

NovusNet

NovusNet is a lightweight networking library designed to simplify client server communication. It allows developers to make secure connections and exchange data in just a few lines of code without the complexity of larger libraries such as Boost.Asio or others.

NovusNet abstracts away low-level socket handling and encryption, allowing you to focus on building your application instead of managing networking boilerplate.

Key Features

  • Get a client and server communicating in under 10 lines of code!
  • Native encryption for all data transmission
  • NFTP (Novus File Transfer Protocol): Send and receive files of any size with a single function call
  • No unnecessary overhead or complexity
  • Designed for ease of use and rapid integration

Early Development

  • APIs and syntax may change frequently

  • Bugs are expected, feedback and reports are appreciated!

  • NFTP is not yet fully stress-tested with large files

  • Currently Linux only

Motivation

Networking can be difficult to approach, especially for beginners. Setting up sockets, handling errors, and implementing encryption often requires significant effort and repetition across projects.

NovusNet was created to eliminate that hardwork by providing a simple, reusable solution for secure communication. Whether you're learning networking or building a small project, NovusNet allows you to move faster and focus on building.

Contributors

Usage Overview

Refer to documentation.md for a full API reference. Below is an example:

Server Example:

#include "nn.hpp"
#include <iostream>
#include <chrono>

int main() {
    runServer(9090, "YOUR_PASSWORD");

    onMessage([](int clientN, std::string msg) {
        std::cout << "Client " << clientN << ": " << msg << "\n";
    });

    while (true) {
        std::this_thread::sleep_for(std::chrono::milliseconds(100));
    }
}

Client Example:

#include "nn.hpp"
#include <iostream>

int main() {
    std::string msg;

    int client = runClient("127.0.0.1", 9090, "YOUR_PASSWORD");

    msg = recvMsg(client);
    int clientID = std::stoi(msg);

    while (true) {
        std::getline(std::cin, msg);
        sendMsg(msg, clientID);
    }

    return 0;
}

Installation

1. Clone the repository:

git clone <repository-url>

2. Copy required files:

  • include/nn.hpp -> your project’s include directory
  • src/nn.cpp -> your project’s source directory

3. Include the library:

#include "nn.hpp"

4. If using CMake:

add_executable(PROJECTNAME
    src/yourfile.cpp
    src/nn.cpp
)

target_include_directories(PROJECTNAME PRIVATE include)

find_package(OpenSSL REQUIRED)
target_link_libraries(PROJECTNAME OpenSSL::SSL OpenSSL::Crypto)

5. Generate encryption keys:

chmod +x gen.sh
./gen.sh

Note

If anyone can help me maintain this, please do. It's very hard maintaining it fully on my own although nobody uses it. Pull requests or discussions in issues are heavily appreciated!!

Made by Mehdi B.R (Nullora @ Novus)