Giter Site home page Giter Site logo

nxlinux / sourcercon Goto Github PK

View Code? Open in Web Editor NEW

This project forked from phil25/sourcercon

0.0 0.0 0.0 8 KB

C++ Source RCON implementation

Home Page: https://developer.valvesoftware.com/wiki/Source_RCON_Protocol

License: MIT License

Shell 6.11% C++ 93.89%

sourcercon's Introduction

C++ Source RCON implementation

Uses Valve's Source RCON protocol for communicating with remote Source engine servers.

Contents

Features ^

  • Implemented as a C++ class
  • Exposes a very simple interface
  • Supports multi-packet responses
  • Non-threaded, delays for larger reponses
  • Connection timeout (default 4 seconds)

Notes about this implementation:

  • This is not a standalone application.
  • It works on UNIX systems only as of now.

Example Usage ^

Prints test.

srcon client = srcon("127.0.0.1", 27015, "password");
std::string response = client.send("echo test");
std::cout << response << std::endl;

Constructors ^

  1. srcon(srcon_addr addr, int timeout=SRCON_DEFAULT_TIMEOUT)
    • addrsrcon_addr struct
    • timeout — connection timeout in seconds (defaults to 4)
  2. srcon(std::string address, int port, std::string pass, int timeout=SRCON_DEFAULT_TIMEOUT)
    • address — address of the server
    • port — port of the server
    • pass — rcon password of the server
    • timeout — connection timeout in seconds (defaults to 4)

Address Structure ^

srcon_addr struct consists of:

  1. std::string addr — address of the server
  2. int port — port of the server
  3. std::string pass — rcon password of the server

Multi-packet Response ^

Using a method by Koraktor as explained here.

After each SERVERDATA_EXECCOMMAND request, a SERVERDATA_RESPONSE_VALUE packet is sent, which is used as a terminator package. This adds overhead to communication, but assures a reliable reception of all responses. For lengths of over 1024 bytes, the thread halts to let the buffer get filled (0.5 seconds).

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.