All Projects → sinasamavati → condor

sinasamavati / condor

Licence: Apache-2.0 license
A minimal library for building scalable TCP servers in Erlang

Programming Languages

erlang
1774 projects
Makefile
30231 projects

Labels

Projects that are alternatives of or similar to condor

okhoxi-serac
冰塔协议-传输层协议
Stars: ✭ 33 (-56%)
Mutual labels:  tcp
overload
📡 Overload DoS Tool (Layer 7)
Stars: ✭ 167 (+122.67%)
Mutual labels:  tcp
AndroidNetMonitor
This project aims to collect and analyze traffic information of Android.(采集手机发送和接收的报文简要信息,并且根据socket记录每个报文对应哪个手机app)
Stars: ✭ 25 (-66.67%)
Mutual labels:  tcp
iroko
A platform to test reinforcement learning policies in the datacenter setting.
Stars: ✭ 55 (-26.67%)
Mutual labels:  tcp
NLog
Flexible logging for C# and Unity
Stars: ✭ 158 (+110.67%)
Mutual labels:  tcp
funboost
pip install funboost,python全功能分布式函数调度框架,。支持python所有类型的并发模式和全球一切知名消息队列中间件,python函数加速器,框架包罗万象,一统编程思维,兼容50% python编程业务场景,适用范围广。只需要一行代码即可分布式执行python一切函数。旧名字是function_scheduling_distributed_framework
Stars: ✭ 351 (+368%)
Mutual labels:  tcp
netxduo
Azure RTOS NetX Duo is an advanced, industrial-grade TCP/IP network stack designed specifically for deeply embedded real-time and IoT applications
Stars: ✭ 151 (+101.33%)
Mutual labels:  tcp
mongoose
Embedded Web Server
Stars: ✭ 8,968 (+11857.33%)
Mutual labels:  tcp
network exporter
ICMP & MTR & TCP Port & HTTP Get - Network Prometheus exporter
Stars: ✭ 162 (+116%)
Mutual labels:  tcp
NakovForwardServer
TCP port forwarding software, written in Java: forwards a local TCP port (e.g. 127.0.0.1:1521) to external port (e.g. 0.0.0.0:1522)
Stars: ✭ 41 (-45.33%)
Mutual labels:  tcp
nxdk-rdt
Remote Dev Tool is a tool to remote control an Xbox using memory access and RPC
Stars: ✭ 23 (-69.33%)
Mutual labels:  tcp
quebec-power-grid-talk
🎭 Quebec's 735kv power lines can survive the apocalypse, but can they run TCP?!
Stars: ✭ 31 (-58.67%)
Mutual labels:  tcp
mqtt
The fully compliant, embeddable high-performance Go MQTT v5 server for IoT, smarthome, and pubsub
Stars: ✭ 356 (+374.67%)
Mutual labels:  tcp
MQTTnet
MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker). The implementation is based on the documentation from http://mqtt.org/.
Stars: ✭ 3,309 (+4312%)
Mutual labels:  tcp
XAsyncSockets
XAsyncSockets is an efficient Python/MicroPython library of managed asynchronous sockets.
Stars: ✭ 28 (-62.67%)
Mutual labels:  tcp
go-eventserver
A socket server which reads events from an event source and forwards them to the user clients when appropriate
Stars: ✭ 18 (-76%)
Mutual labels:  tcp
ChatServerTCP
保密型聊天软件服务器 /Private Chat Server
Stars: ✭ 14 (-81.33%)
Mutual labels:  tcp
dperf
dperf is a DPDK based 100Gbps network performance and load testing software.
Stars: ✭ 1,320 (+1660%)
Mutual labels:  tcp
p2p
Simple implementation of a p2p network in Go
Stars: ✭ 12 (-84%)
Mutual labels:  tcp
ns2 bbr
Google's TCP BBR implementation for ns2 network simulator
Stars: ✭ 19 (-74.67%)
Mutual labels:  tcp

Condor

Condor is a minimal library for building scalable TCP servers in Erlang.

Quick Overview

-module(ping_server).
-behaviour(condor_listener).

%% condor_listener callbacks
-export([init/1]).
-export([handle_packet/2]).
-export([handle_info/2]).
-export([terminate/2]).

init([]) ->
    {ok, undefined}.

handle_packet(<<"stop">>, State) ->
    {send_and_stop, <<"ok">>, normal, State};
handle_packet(<<"ping">>, State) ->
    {send, <<"pong">>, State}.

handle_info(_Msg, State) ->
    {ok, State}.

terminate(_Reason, _State) ->
    ok.

Features

  • Reusable supervised connection acceptors
  • Neat packet frames and buffers

API

Start a Listener

 condor:start_listener(Name, Opts, Module, InitialState) ->
     {ok, Pid} | {error, Reason}

 Name = atom()
 Opts = #{
          ip => inet:ip_address(),
          port => inet:port_number(),
          max_acceptors => non_neg_integer(),
          len => 1 | 2,
          timeout => non_neg_integer()
        }
Module = atom()
InitialState = any()
Pid = pid()
Reason = any()

Opts:

  • ip: to what IP Condor should bind.
  • port: on what port Condor should listen.
  • max_acceptors: maximum number of socket acceptors, or in other words, maximum number of concurrent connections.
  • len: length of the indicator of a packet’s size.
  • timeout: the time limit, in milliseconds, for a packet to be buffered.

Default Opts:

#{
   ip => {127, 0, 0, 1},
   len => 2,
   timeout => 10000,
   max_acceptors => 100
 }

Stop a Listener

condor:stop_listener(Name) -> ok

Name = atom()

Condor Listener Callbacks

Behaviour: condor_listener

init(State) -> Result

handle_packet(Packet, State) -> Result

handle_info(Msg, State) -> Result

terminate(Reason, State) -> ok

Result = {ok, State}
       | {send, Packet, State}
       | {stop, Reason, State}
       | {send_and_stop, Packet, Reason, State}

Packet = binary()
State = any()
Reason = atom()

Events that invoke callbacks:

event                       callback module
-----                       ---------------
new connection         ---> Module:init/1
new packet             ---> Module:handle_packet/2
receiving a message    ---> Module:handle_info/2
packet timeout         ---> Module:handle_info/2
connection termination ---> Module:terminate/2

Condor takes care of framing packets. Each packet frame consists of two segments: Len | Packet.

Len indicates the length of Packet in big-endian order.

The length of Len is two bytes by default, though it can be modified with the len option.

Condor also takes care of buffering. So, Module:handle_packet/2 is called only when an entire packet is received. That is, when Packet is buffered according to the value of Len. Len will then be stripped off, and only Packet will be passed to Module:handle_packet/2. However, if Packet is not received completely in Timeout milliseconds (which would be specified in Opts), Module:handle_info/2 will be invoked with Msg being {timeout, Buffer :: binary()}.

A callback’s Result:

  • {send, Packet, State} sends Packet (in the frame: Len | Packet).
  • {stop, Reason, State} terminates the connection.
  • {send_and_stop, Packet, Reason, State} sends Packet (in the frame: Len | Packet), and then terminates the connection.

License

Apache License, Version 2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].