GithubHelp home page GithubHelp logo

crunchyfrog / libevws Goto Github PK

View Code? Open in Web Editor NEW
10.0 10.0 8.0 432 KB

WebSockets server library in C using libevent and wslay

License: MIT License

Shell 1.06% C 92.41% Makefile 4.23% M4 2.30%

libevws's People

Contributors

crunchyfrog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

libevws's Issues

not work with thread

as the echo server example:

unsigned char *g_data = NULL;
int g_len = 0;

void echo_data(struct evwsconn_new *conn){
    sleep(1);
    evwsconn_send_message(conn, 1, g_data, g_len);
}

void message_handler(struct evwsconn* conn, enum evws_data_type data_type,
    const unsigned char* data, int len, void* user_data) {
    fprintf(stdout, "---->receive message: %d, %d!!!!\n", data_type, len);
    if(g_data != NULL) free(g_data);

    g_data = malloc(len * sizeof(unsigned char));
    memset(g_data, 0, len);
    memcpy(g_data, data, len);
    g_len = len;


    pthread_t thread;
    //not work with thread!!
    pthread_create(&thread, NULL, (void *)echo_data, (void *)conn);

    //this is work
    //echo_data(conn);
}

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.