CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Thu Oct 19, 2017 7:16 pm

All times are UTC+01:00

Post new topic  Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Jun 01, 2016 2:42 pm 

Joined: Mon Feb 22, 2016 10:16 am
Posts: 4
hi, I am trying to apply the example project I found on this project to send and receive tcp or udp data from a Codesys simulation of a peice of structured-text code to a C# tcp server or udp server(I will choose between TCP and UDP later, now I just want to get something working).

I am having no luck with the example, is there a trick to making this work?

I have tried adding a cyclica task with UDPProducer, and I am guessing I shoudl be setting diSOcket=0 to make the code run UdPOpenSendSocket(iPort)?

I have set up a UDP server on my computer on port 5000 run the following code, but diSendSocket =0 continously:

diSendSocket : DINT :=0;
iPort : INT:=5000;
stDestIPAddress : STRING := '';
diRecvSocket: DINT;
bySend : ARRAY[0..10] OF BYTE := 0,1,2,3,4,5,6,7,8,9,10;
bSent: BOOL := TRUE;
bActive: BOOL := TRUE;

IF bActive THEN
IF diSendSocket = 0 THEN
diSendSocket := UdpOpenSendSocket(iPort);

IF diSendSocket > 0 AND bSent THEN
bSent := FALSE;
UdpSendData(diSendSocket, iPort, stDestIPAddress, ADR(bySend), SIZEOF(bySend));

PostPosted: Sun Jun 05, 2016 8:32 pm 
Frequent User
Frequent User

Joined: Thu Jun 14, 2007 9:49 am
Posts: 978
in simulation this does not work, as the target is not the asame.
so it does not know how to deal with it.

computer shooter
paul deelen
jacob van wassenaerstraat 29
NL 5224 GG 's-Hertogenbosch
skype shooter paul.deelen
phone +31736139136

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

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