CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Threaded View

  1. #1
    Join Date
    Oct 2017
    Posts
    5

    [RESOLVED] Incompatible parameter

    Hello, I am using happyhttp to create a class to communicate with a server. I've encountered an error that I simply can't figure out how to fix and still use my class.
    It has been 4-5 hours trying to figure this out
    Neccesary info about the library are as follows:

    happyhttp binds 3 functions
    Code:
    onBegin 
    OnData
    onComplete
    to another function
    Code:
    setcallbacks()
    Taken from their site, these functions are defined as follows:
    Code:
    typedef void (*ResponseBegin_CB)( const Response* r, void* userdata )
    Invoked when all the headers for a response have been received.
    The Response object can be queried to determine status and header values.
    userdata is the same value that was passed in to Connection::setcallbacks().
    
    typedef void (*ResponseData_CB)( const Response* r, void* userdata, const unsigned char* data, int numbytes )
    This callback is invoked to pass out data from the body of the response. It may be called multiple times, or not at all (if there is no body).
    
    typedef void (*ResponseComplete_CB)( const Response* r, void* userdata )
    Once a response is completed, this callback is invoked. When the callback returns, the respsonse object will be destroyed.
    the function that these are passed to are
    Code:
    void setcallbacks( ResponseBegin_CB begincb, ResponseData_CB datacb, ResponseComplete_CB completecb, void* userdata )

    The example that their site offers is:
    Code:
    static int count=0;
    
    // invoked when response headers have been received
    void OnBegin( const happyhttp::Response* r, void* userdata )
    {
    	printf( "BEGIN (%d %s)\n", r->getstatus(), r->getreason() );
    	count = 0;
    }
    
    // invoked to process response body data (may be called multiple times)
    void OnData( const happyhttp::Response* r, void* userdata, const unsigned char* data, int n )
    {
    	fwrite( data,1,n, stdout );
    	count += n;
    }
    
    // invoked when response is complete
    void OnComplete( const happyhttp::Response* r, void* userdata )
    {
    	printf( "COMPLETE (%d bytes)\n", count );
    }
    
    
    void TestGET()
    {
    	happyhttp::Connection conn( "www.scumways.com", 80 );
    	conn.setcallbacks( OnBegin, OnData, OnComplete, 0 );
    
    	conn.request( "GET", "/happyhttp/test.php" );
    
    	while( conn.outstanding() )
    		conn.pump();
    }
    http://prntscr.com/guo9y3 <-hint for the error
    http://prntscr.com/guoa3d <-second instance of the error

    http://prntscr.com/guoabj <-compiler output

    My code is a little large to put here, the paste.ee for is is: https://paste.ee/p/QCqd0
    I am not even sure how to name the type of error I'm having past "incompatible Parameter" so i have included 3 screenshots of what my compiler is telling me.

    Can somebody please help me identify how to pass my functions to
    Code:
    setcallbacks
    without this error?
    Attached Images Attached Images

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured