VSCP Helper Libraries

Trace: helper_lib_api_initialization


|

Meta

VSCP Helper library API - Initialization

This part describes the main functionality and communication methods available in the library.

vscphlp_newSession

Opens a new communication session. This is the first method that should be called before TCP/IP communication can be established.

long vscphlp_newSession( void )
return

A session handle or zero if a session could not be created.

Example
    handle1 = vscphlp_newSession();
    if (0 != handle1 ) {
        printf( "Handle one OK %d\n", handle1 );
    }
    else {
        printf("\aError: Failed to get handle for channel 1\n");
    }

vscphlp_closeSession

Close an open session. This is the last operation that should be done after you are done with a TCP/IP session.

long vscphlp_closeSession( long handle )
const long handle

A handle that has been obtained from vscphlp_newSession

return

Nothing

Example

This is a simple windows console example that log on to a server that is on the host 192.618.1.9 and standard port 9598 and issue the NOOP command and then terminates. You link to the vscphelper.lib library and make sure the vscphelper.dll is in the path.

#include "vscphelperlib.h"
 
int main(int argc, char* argv[])
{
    long handle;
    handle = vscphlp_newSession();
 
    vscphlp_Open( handle, 
                 "127.0.0.1:9598",
                 "admin",
                 "secret" ); 
 
    vscphlp_Noop( handle );
 
    vscphlp_Close( handle );
    vscphlp_closeSession( handle );
 
    return 0;
}



Copyright © 2000-2017 Åke Hedman, Paradise of the Frog / Grodans Paradis AB