apps/vm/components/helloworld/src/hello.c
/*
    vchantests_bigwrite:
        Read a large block of data from the client,
        Large enough that it must be read in multiple passes
        When a chunk of data is recieved, send it back to the client
*/
Read a large block of data from the client,
Large enough that it must be read in multiple passes
When a chunk of data is recieved, send it back to the client
Read a large block of data from the client Large enough that it must be read in multiple passes When a chunk of data is recieved send it back to the client
int vchantests_bigwrite(libvchan_t *ctrl) {
    int ret, sz = 0;
    char buf[VM_BIGWRITE_COMP_BUF_SIZE];
    libvchan_t *writeback = libvchan_server_init(0, VM_BIGWRITE_PORT, 0, 0);
    if(writeback != NULL)
        writeback = link_vchan_comp(writeback, &con);
    assert(writeback != NULL);
    ret = libvchan_recv(ctrl, &sz, sizeof(size_t));
    assert(ret > 0);
    DHELL("bigwrite: going to read %d bytes\n", sz);
    while(sz != 0) {
        ret = libvchan_read(ctrl, buf, VM_BIGWRITE_COMP_BUF_SIZE);
        assert(ret >= 0);
        sz -= ret;
        ret = libvchan_send(writeback, buf, ret);
    }
    libvchan_close(writeback);
    DHELL("bigwrite: finished\n");
    return 0;
}
int vchantests_bigwrite ( libvchan_t * ctrl ) { int ret , sz = 0 ; char buf [ VM_BIGWRITE_COMP_BUF_SIZE ] ; libvchan_t * writeback = libvchan_server_init ( 0 , VM_BIGWRITE_PORT , 0 , 0 ) ; if ( writeback != NULL ) writeback = link_vchan_comp ( writeback , & con ) ; assert ( writeback != NULL ) ; ret = libvchan_recv ( ctrl , & sz , sizeof ( size_t ) ) ; assert ( ret > 0 ) ; DHELL ( " \n " , sz ) ; while ( sz != 0 ) { ret = libvchan_read ( ctrl , buf , VM_BIGWRITE_COMP_BUF_SIZE ) ; assert ( ret >= 0 ) ; sz -= ret ; ret = libvchan_send ( writeback , buf , ret ) ; } libvchan_close ( writeback ) ; DHELL ( " \n " ) ; return 0 ; }
vchantests_bigwrite:
Read a large block of data from the client,
Large enough that it must be read in multiple passes
When a chunk of data is recieved, send it back to the client
vchantests_bigwrite : Read a large block of data from the client Large enough that it must be read in multiple passes When a chunk of data is recieved send it back to the client