• 2013-09-05

    A 150 lines comet server written in C

    Views: 6811 | 8 Comments

    Comet is a web application model that used to “push” data to web page(browser), which can be used in applications like Web Chat, News Feed, Stock Market, even Web Game.

    There are many opensourced comet servers, but most big companies develope their own comet server. As we know, Facebook’s comet server is built on Mochiweb, an opensourced Erlang Web server.

    Nginx’s module nginx-push-stream is another solution, but it is suitable for small system, it can not handle 100K+ connections, according to our experiences. A comet should be able to handle 1 million connections.

    Many companies develope their own comet server, for performance, and for integration with existing systems.

    Writing a comet server is very easy with libevent, the famous network library. The simple C comet server is only 150 lines of code, can be down load from here: https://github.com/ideawu/icomet

    Posted by ideawu at 2013-09-05 21:56:21
  • 2013-08-06

    WebRTC C++ audio recording example

    Views: 17949 | 1 Comment

    The WebRTC project included a voice engine(GIPS, Global IP Solutions), here is an example to show how you can use the voice engine to record audio from microphone.

    #include <stdio.h>
    #include <stdlib.h>
    #include <assert.h>
    #include "webrtc/modules/audio_device/include/audio_device.h"
    #include "webrtc/common_audio/resampler/include/resampler.h"
    #include "webrtc/modules/audio_processing/aec/include/echo_cancellation.h"
    class AudioTransportImpl: public webrtc::AudioTransport
        AudioTransportImpl(webrtc::AudioDeviceModule* audio){
        virtual int32_t RecordedDataIsAvailable(
            const void* audioSamples,
            const uint32_t nSamples,
            const uint8_t nBytesPerSample,
            const uint8_t nChannels,
            const uint32_t samplesPerSec,
            const uint32_t totalDelayMS,
            const int32_t clockDrift,
            const uint32_t currentMicLevel,
            const bool keyPressed,
            uint32_t& newMicLevel)
            printf("record %d %d %d %d %d %d %d %d\n", nSamples,
                nBytesPerSample, nChannels,
                samplesPerSec, totalDelayMS,
                clockDrift, currentMicLevel, keyPressed);
            // now you have the audioSamples...
            return 0;
    int main(int argc, char **argv){
        webrtc::AudioDeviceModule *audio;
        audio = webrtc::CreateAudioDeviceModule(0, webrtc::AudioDeviceModule::kPlatformDefaultAudio);
        int num;
        int ret;
        num = audio->RecordingDevices();
        printf("Input devices: %d\n", num);
        for(int i=0; i<num; i++){
            char name[webrtc::kAdmMaxDeviceNameSize];
            char guid[webrtc::kAdmMaxGuidSize];
            int ret = audio->RecordingDeviceName(i, name, guid);
            if(ret != -1){
                printf("    %d %s %s\n", i, name, guid);
        AudioTransportImpl callback(audio);

    For more webrtc demos, visit: https://github.com/ideawu/webrtc-demo

    Posted by ideawu at 2013-08-06 23:08:32 Tags: ,
  • 2013-01-28

    Connect to SSDB server with telnet

    Views: 9544 | 2 Comments

    SSDB’s network protocol is very simple, you can connect to a SSDB server with telnet and interact with commands:

    $ telnet 8888
    Connected to
    Escape character is '^]'.
    Posted by ideawu at 2013-01-28 12:20:29 Tags:
  • 2013-01-13

    SSDB is now available on github

    Views: 10383 | No Comments

    It seems github is more powerfull and more popular than Google Code, so I migrated SSDB from Google Code to github.

    Link: https://github.com/ideawu/ssdb

    Posted by ideawu at 2013-01-13 21:17:34 Tags: ,
  • 2013-01-06

    SSDB 1.2.0 with replication feature is released!

    Views: 10638 | No Comments

    I am proud to announce SSDB 1.2.0 is released! SSDB 1.2.0 is a major step of SSDB, the LevelDB server with multi data types.

    In this version, the important feature – Replication(master-slave) is supported. Replication is the most important feature of storage server in production enviroment. LevelDB has the ability to handle thousands of GBs of data on one common used computer, and SSDB do the networking, backup, replication stuffs.

    SSDB 1.2.0 is a beta version, the 2.x version will be stable.

    Download SSDB 1.2.0: http://code.google.com/p/zdb/downloads/list

    Posted by ideawu at 2013-01-06 15:27:13 Tags: ,
|<<<1234>>>| 2/4 Pages, 16 Results.