Post by anonymous on Hi, I try to send and receive data using a UDP connection via SysSocket 3.5.17.0. While sending data works fine, I have problems with the receiving part. I am able to capture the received data of client side in wireshark But unable to capture it on the codesys
CODESYS Forge
talk
(Post)
Hi, I try to send and receive data using a UDP connection via SysSocket 3.5.17.0. While sending data works fine, I have problems with the receiving part.I am able to capture the data of client side in wireshark but i am unable to capture it in the codesys. Heres the below part of code of client side. PROGRAM POU_udpclient_program VAR istep : INT := 1;//step variable for state machine xStart: BOOL;// Flag to start the UDP protocol iecSocketId: syssocket_interfaces.RTS_IEC_HANDLE;//socket handle for receiving iecCreateResult: syssocket_interfaces.RTS_IEC_RESULT; ipAddr: syssocket.SOCKADDRESS;//Socket address structure for receiving sIpAddress : STRING := '192.168.0.2'; wPort: WORD:= 12346; iecConnectResult : syssocket_interfaces.RTS_IEC_RESULT;//connect paramters sDataRec : STRING[255];//Buffer for received data xiRecBytes : __XINT;//number of bytes received iecRecResult : syssocket_interfaces.RTS_IEC_RESULT;//receive data parameters iecCloseResult : syssocket_interfaces.RTS_IEC_RESULT; END_VAR syssocket.SysSockInetAddr(sIpAddress,ADR(ipAddr.sin_addr)); ipAddr.sin_family := syssocket.SOCKET_AF_INET; ipAddr.sin_port := syssocket.SysSockHtons(wPort); CASE istep OF 1: //create socket IF xStart THEN iecSocketId:= syssocket.SysSockCreate(syssocket.SOCKET_AF_INET,syssocket.SOCKET_DGRAM,syssocket.SOCKET_IPPROTO_IP,ADR(iecCreateResult)); IF iecSocketId = syssocket_interfaces.RTS_INVALID_HANDLE THEN xStart := FALSE; istep := 1; ELSE istep := 2; END_IF END_IF 2: //connect to socket server using setoption iecConnectResult := syssocket.SysSockSetOption(iecSocketId,syssocket.SOCKET_SOL,syssocket.SOCKET_SO_REUSEADDR,ADR(ipAddr),SIZEOF(ipAddr)); istep := 3; 3: //receive data xiRecBytes := syssocket.SysSockRecvFrom(iecSocketId,ADR(sDataRec),SIZEOF(sDataRec),0,ADR(ipAddr),SIZEOF(ipAddr),ADR(iecRecResult)); istep := 4; 4: //close socket iecCloseResult:= syssocket.SysSockClose(iecSocketId); xStart := FALSE; istep := 1; END_CASE
Last updated: 2024-06-03
CoDeSys Implementation
CODESYS Forge
talk
(Thread)
CoDeSys Implementation
Last updated: 2014-04-15
CoDeSys 2.3 Fonts
CODESYS Forge
talk
(Thread)
CoDeSys 2.3 Fonts
Last updated: 2012-07-09
CoDeSys exercises
CODESYS Forge
talk
(Thread)
CoDeSys exercises
Last updated: 2012-06-07
Email In CoDeSys
CODESYS Forge
talk
(Thread)
Email In CoDeSys
Last updated: 2011-08-16
Codesys version 2.3.9.10
CODESYS Forge
talk
(Thread)
Codesys version 2.3.9.10
Last updated: 2009-03-23
CoDeSys to access
CODESYS Forge
talk
(Thread)
CoDeSys to access
Last updated: 2007-01-15
CoDeSys Online
CODESYS Forge
talk
(Thread)
CoDeSys Online
Last updated: 2006-07-10
Codesys Programming Help
CODESYS Forge
talk
(Thread)
Codesys Programming Help
Last updated: 2011-02-23
Internal CodeSys Library
CODESYS Forge
talk
(Thread)
Internal CodeSys Library
Last updated: 2009-03-01
CANopen and CoDeSys
CODESYS Forge
talk
(Thread)
CANopen and CoDeSys
Last updated: 2012-11-21
codesys price strucuture
CODESYS Forge
talk
(Thread)
codesys price strucuture
Last updated: 2013-03-08
Codesys Examples
CODESYS Forge
talk
(Thread)
Codesys Examples
Last updated: 2009-03-19
Codesys Rpi sensors!
CODESYS Forge
talk
(Thread)
Codesys Rpi sensors!
Last updated: 2021-05-18
Codesys function help
CODESYS Forge
talk
(Thread)
Codesys function help
Last updated: 2020-05-02
Problem you codesys
CODESYS Forge
talk
(Thread)
Problem you codesys
Last updated: 2011-01-20
Communicating with Codesys
CODESYS Forge
talk
(Thread)
Communicating with Codesys
Last updated: 2011-02-28
Internal CodeSys Library
CODESYS Forge
talk
(Thread)
Internal CodeSys Library
Last updated: 2009-11-13
Codesys Installation
CODESYS Forge
talk
(Thread)
Codesys Installation
Last updated: 2007-01-22
Codesys with J1939
CODESYS Forge
talk
(Thread)
Codesys with J1939
Last updated: 2009-12-09
CoDeSys Error 3120
CODESYS Forge
talk
(Thread)
CoDeSys Error 3120
Last updated: 2006-09-14
CoDeSys Gateway
CODESYS Forge
talk
(Thread)
CoDeSys Gateway
Last updated: 2006-10-08
XML and CoDeSys
CODESYS Forge
talk
(Thread)
XML and CoDeSys
Last updated: 2008-09-25
Codesys Messages
CODESYS Forge
talk
(Thread)
Codesys Messages
Last updated: 2017-11-30
CoDeSys-PS10
CODESYS Forge
talk
(Thread)
CoDeSys-PS10
Last updated: 2005-08-08
To search for an exact phrase, put it in quotes. Example: "getting started docs"
To exclude a word or phrase, put a dash in front of it. Example: docs -help
To search on specific fields, use these field names instead of a general text search. You can group with AND
or OR
.