#include <WScom.h>
#include <WSCfunctionList.h>
#include <WSCbase.h>
//----------------------------------------------------------
//Function for the event procedure
//----------------------------------------------------------
#include <WSCvssocket.h>
#include <newwin000.h>
static long cnt = 0;

void sock(WSCbase* object){
  //do something...
  WSCvssocket* obj = (WSCvssocket*)object->cast("WSCvssocket");
  char buffer[128];

  //receive data:
  obj->read((WSCuchar*)buffer,128);
  newvlab_002->setProperty(WSNlabelString,buffer);
  newvlab_002->update();

  //send data:
  sprintf(buffer,"return=%d",cnt);
  obj->write((WSCuchar*)buffer,128);
  newvlab_010->setProperty(WSNlabelString,buffer);
  newvlab_010->update();
  cnt++;
}
static WSCfunctionRegister  op("sock",(void*)sock);
