I have to discuss between one robot and two computers using socket.
To get a generic module, I create a StartConnect function. Who call SocketCreate and SocketConnect and manage error.
Then I use other function to send and receive data.
So I imagine using a record for each computer with address, port socketdev and other things.
I put the record as function parameter like this:
RECORD Cir_Param
string sAdrServer;
num nPortServer;
socketdev sdSocketServer;
num nMaxTimeSocket;
num nMAXTRY;
string sReceivedString;
ENDRECORD
LOCAL FUNC bool StartClient(INOUT Cir_Param pcirParam)
SocketCreate pcirParam.sdSocketServer;
SocketConnect pcirParam.sdSocketServer,pcirParam.sAdrServer,pcirParam.nPortServer\Time:=pcirParam.nMaxTimeSocket;
ENDFUNC
But when I check program, I’ve got :
Type error(83): Cir_Param not value type.
This is due to socketdev in RECORD. When I remove it and comment lines using it. No error is reported.
So, how can I passe socketdev as parameter?
As each computer must have own socketdev.
And I don’t want to make a function for each.
First, why a function with the return type bool? I don’t see that in there to return a true or false. Why not a proc? Second, why inout parameter? That is why you cannot have a non-value parameter. leave that off and you can use non-value parameter.