<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to TCP Client using SysSocket library troubles</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/8cdd69243f/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/8cdd69243f/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/8cdd69243f/</id><updated>2021-11-16T15:24:29.413000Z</updated><subtitle>Recent posts to TCP Client using SysSocket library troubles</subtitle><entry><title>TCP Client using SysSocket library troubles</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/8cdd69243f/?limit=25#005d" rel="alternate"/><published>2021-11-16T15:24:29.413000Z</published><updated>2021-11-16T15:24:29.413000Z</updated><author><name>hagendas</name><uri>https://forge.codesys.com/u/hagendas/</uri></author><id>https://forge.codesys.com4f3ea3770046d12b25bd789acfb47ead6bcae7c3</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello, I have a PLC that does not support NBS ( DSE M840 MKII )&lt;/p&gt;
&lt;p&gt;I am trying to create a TCP Client connection to a MikroTik router to use with MikroTik API&lt;/p&gt;
&lt;p&gt;I could do it easily with the NBS functions, but having trouble getting anything working with SysSocket.&lt;/p&gt;
&lt;p&gt;I couldn't find any documentation on the forums or anywhere else on how to properly create a connection and send/receive data.&lt;/p&gt;
&lt;p&gt;From some info that I found, I wrote a simple ping program to test connection to the router.&lt;br/&gt;
Although this returns TRUE, using wireshark, nothing is transfered to or from the PLC&lt;/p&gt;
&lt;p&gt;Does anyone know where I could find more info on SysSocket library or has any examples with working TCP Client connection?&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;PROGRAM PLC_PRG&lt;/span&gt;
&lt;span class="err"&gt;VAR &lt;/span&gt;
&lt;span class="err"&gt; //// PING /////&lt;/span&gt;
&lt;span class="err"&gt;   PingTime:    UDINT;&lt;/span&gt;
&lt;span class="err"&gt;   PingOk:      BOOL;&lt;/span&gt;
&lt;span class="err"&gt;   _IPSTRING: STRING := '192.168.1.1';&lt;/span&gt;
&lt;span class="err"&gt;END_VAR&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;// Ping command&lt;/span&gt;
&lt;span class="err"&gt;IF CmpErrors.Errors.ERR_OK = SysSockPing(szIPAddress:=_IPSTRING, ulTimeout:=500, pulReplyTime:= ADR(PingTime)) THEN&lt;/span&gt;
&lt;span class="err"&gt;   PingOk := TRUE;   &lt;/span&gt;
&lt;span class="err"&gt;ELSE&lt;/span&gt;
&lt;span class="err"&gt;   PingOk := FALSE;   &lt;/span&gt;
&lt;span class="err"&gt;END_IF&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;</summary></entry></feed>