CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Tue Feb 20, 2018 8:45 pm

All times are UTC+01:00




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

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

I wrote in CODESYS socket communication like this:
Code:
IF run = TRUE THEN
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));


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 ?


Top
   
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 1 guest


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:  
cron
Powered by phpBB® Forum Software © phpBB Limited