CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Sat Feb 23, 2019 8:31 am

All times are UTC+01:00

Post new topic  Reply to topic  [ 1 post ] 
Author Message
PostPosted: Mon Dec 11, 2017 8:14 pm 

Joined: Sun Aug 20, 2017 8:15 am
Posts: 14

I wrote in CODESYS socket communication like this:
sa.sin_family       :=   SOCKET_AF_INET;
sa.sin_port         :=  SysSockHtons(port);
result            :=  SysSockInetAddr(strIpAddres, ADR(sa.sin_addr.ulAddr)); //convert Ip STRING  to IP adres

hSocket          :=   SysSockCreate(SOCKET_AF_INET, SOCKET_STREAM, SOCKET_IPPROTO_TCP, ADR(result));  //tworzy nowe gniazdo
result            :=   SysSockCOnnect(hSocket, ADR(sa), SIZEOF(sa));

numberOfSendBytes   :=   SysSockSend(hSocket, ADR(str),  30 ,0, ADR(result));

//numberOfBytes      :=   SysSockRecv(hSocket, ADR(str2), 100,0,ADR(result));

run := FALSE;

//recivedX := SysSockSelect(1,NULL,NULL,NULL,NULL,NULL);
//IF  recivedX>0  THEN
//numberOfBytes      :=   SysSockRecv(hSocket, ADR(str2), 100,0,ADR(result));

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 ?

Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 1 post ] 

All times are UTC+01:00

Who is online

Users browsing this forum: No registered users and 4 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited