WSReleaseEnvIDString (C Function)

void WSReleaseEnvIDString(WSLINK link,const char *s)

disowns the memory allocated by WSGetLinkedEnvIDString() to store the identification string s.


  • Sometimes it is useful to identify sides of a WSTP connection prior to setting up packet-based communication. Using WSSetEnvIDString() the developer can give an identification string for a program that will be exchanged every time a link is established with another program. WSGetLinkedEnvIDString() retrieves the other side of the link's name.
  • WSReleaseEnvIDString() is declared in the WSTP header file wstp.h.


Basic Examples  (1)

#include <string.h>
#include "wstp.h"

/* read the other side of the link's id string and check that it is "My Remote Program" */

int f(WSLINK lp)
    int isCorrectProg;
    const char *envid;

    if(! WSGetLinkedEnvIDString(lp, &envid))
        { /* unable to get remote side id from lp */ }

    isCorrectProg = strcmp(envid, "My Remote Program") == 0;

    WSReleaseEnvIDString(lp, envid, length);

    return isCorrectProg;