I wrote in CODESYS socket communication like this:
IFrun=TRUETHENsa.sin_family     :=  SOCKET_AF_INET;sa.sin_port      := SysSockHtons(port);result        := SysSockInetAddr(strIpAddres, ADR(sa.sin_addr.ulAddr)); //convert Ip STRING to IP adreshSocket       :=  SysSockCreate(SOCKET_AF_INET, SOCKET_STREAM, SOCKET_IPPROTO_TCP, ADR(result)); //tworzy nowe gniazdoresult        :=  SysSockCOnnect(hSocket, ADR(sa), SIZEOF(sa));numberOfSendBytes  :=  SysSockSend(hSocket, ADR(str), 30 ,0, ADR(result));//numberOfBytes    :=  SysSockRecv(hSocket, ADR(str2), 100,0,ADR(result));SysSockClose(hSocket);run :=FALSE;END_IF//recivedX :=SysSockSelect(1,NULL,NULL,NULL,NULL,NULL);//IF recivedX>0 THEN//numberOfBytes    :=  SysSockRecv(hSocket, ADR(str2), 100,0,ADR(result));//END_IF
With sending data everything is ok, but I have problem with receive data.
It is a bad idea is all time use SysSockRecv function. I read that I must use SysSockSelect function.
I do not now how use it. Can you give me a hint how solve my problem ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I wrote in CODESYS socket communication like this:
With sending data everything is ok, but I have problem with receive data.
It is a bad idea is all time use SysSockRecv function. I read that I must use SysSockSelect function.
I do not now how use it. Can you give me a hint how solve my problem ?