[At master]
BYTE Srbuf[100]; //Buffer for receiving
Cmd[0] = 2; //The number of listeners + 1 (here, there is one listener)
Cmd[1] = TalkerAdrs; //The address of device that sends data
Cmd[2] = ListenerAdrs; //The address of device that receives data (own address)
Ret = GpListen(Cmd, &Srlen, Srbuf); //Srlen = data length: Srbuf = buffer that stores data
[At slave]
BYTE Srbuf[100]; //Buffer for receiving
Cmd[0] = 0; //As cannot specify multi line message, writes code like this.
Ret = GpListen(Cmd, &Srlen, Srbuf); //Srlen = data length: Srbuf = buffer that stores data
Notes: The receiving data program is almost the same as the transmitting data. Uses GpListen function. The value of Srlen must not exceed the number of data in Srbuf (the number of bytes). For receiving data, the size of Srbuf must be specified. To easy understand the error, the CheckRet function is provided. This function code is written in standard module. Writing this function in the standard module makes it used for general purpose. This function can be used in other programs by "Add File". (The code of CheckRet function is written in "SubFunc.cpp".)
Up to now, the receiving routine is created.