<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Socket Connection</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/b21d332b46/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/b21d332b46/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/b21d332b46/</id><updated>2020-02-27T20:25:34.045000Z</updated><subtitle>Recent posts to Socket Connection</subtitle><entry><title>Socket Connection</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/b21d332b46/?limit=25#5a42" rel="alternate"/><published>2020-02-27T20:25:34.045000Z</published><updated>2020-02-27T20:25:34.045000Z</updated><author><name>orpheus</name><uri>https://forge.codesys.com/u/orpheus/</uri></author><id>https://forge.codesys.combbeb2bc3bc83fbd2d48f9702ee147646809177a1</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Don't worry.....There is no problem...&lt;/p&gt;
&lt;p&gt;Thanks anyway for your post.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Socket Connection</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/b21d332b46/?limit=25#465b" rel="alternate"/><published>2020-02-27T20:25:32.618000Z</published><updated>2020-02-27T20:25:32.618000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.comf1d52b349090f6837c3dedee5ea8da01178a730f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; crthomas1234&lt;/p&gt;
&lt;p&gt;Hello, I am sorry, I missed the part about TCP/IP in your orignal post.  The functions in the SysSocket.lib are also available for TCP connections.&lt;/p&gt;
&lt;p&gt;But from what I have been told my 3S Support, the TCP functions aren't working well yet.&lt;/p&gt;
&lt;p&gt;I have not tried them myself.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Socket Connection</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/b21d332b46/?limit=25#7ab3" rel="alternate"/><published>2020-02-27T20:25:31.240000Z</published><updated>2020-02-27T20:25:31.240000Z</updated><author><name>orpheus</name><uri>https://forge.codesys.com/u/orpheus/</uri></author><id>https://forge.codesys.com1220e3eafe25a4dea2900948b9e6f8d203c22248</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thank you very much crthomas1234.........&lt;/p&gt;
&lt;p&gt;Unfortunatly my application can't work with UDP connection because the server is a "Customer Server" and he always use TCP connection...&lt;/p&gt;
&lt;p&gt;Thanks again&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Socket Connection</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/b21d332b46/?limit=25#7143" rel="alternate"/><published>2020-02-27T20:25:27.429000Z</published><updated>2020-02-27T20:25:27.429000Z</updated><author><name>DaveW</name><uri>https://forge.codesys.com/u/davew/</uri></author><id>https://forge.codesys.com70f0b0afc7935854622b4075b40f7ccb5b6471b1</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Hello I am completely new to CoDeSys&lt;/p&gt;
&lt;p&gt;I am in a simular position to Orpheus, investigating creating a TCP socket. Then waiting for a connection. Trying to recieve data, then to reply.&lt;/p&gt;
&lt;p&gt;The example I found was of little help as it was for V2.3 and so converting it to V3.3 required more knowledge than I have at the moment.&lt;/p&gt;
&lt;p&gt;Has anyone a V3.3 example for TCP ?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Socket Connection</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/b21d332b46/?limit=25#8742" rel="alternate"/><published>2020-02-27T20:25:26.062000Z</published><updated>2020-02-27T20:25:26.062000Z</updated><author><name>Avgur</name><uri>https://forge.codesys.com/u/avgur/</uri></author><id>https://forge.codesys.comfeefa10182c4086f4df2402881cd0fed7ab534e2</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;orpheus hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
I am trying to develop a TCP/IP application for the first time... &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Read "Beej's Guide to Network Programming Using Internet Sockets" &lt;a class="" href="http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html" rel="nofollow"&gt;http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It's a great thing to understand socket programming for beginners!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Socket Connection</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/b21d332b46/?limit=25#7f3c" rel="alternate"/><published>2020-02-27T20:25:22.159000Z</published><updated>2020-02-27T20:25:22.159000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.com672911c8c0fa2968394d61def0c2eaa6d3099146</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; crthomas1234&lt;/p&gt;
&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I have been working on a similar project and after lots of trial and error, I have data being sent over UDP to a specified port. &lt;/p&gt;
&lt;p&gt;The socket interface mirrors the Unix/Windows socket programming with a few changes.&lt;/p&gt;
&lt;p&gt;Here is the code that I am using to send some simple some incrementing integers to a a receiver program on my PC that I wrote using c#.&lt;/p&gt;
&lt;p&gt;CoDeSys V3 supports 2 types of socket layer management.  The first is a basic control where you create a socket handle and then write data to that socket.  The second is the Asynchronous socket management where you create a task manager to handle all requests and then project the task handler with the function calls so that it can be much more efficient in applications where you are opening, closing, and exchanging data on a lot of different connections.&lt;/p&gt;
&lt;p&gt;I hope this code helps.  You will need the following libraries added:&lt;/p&gt;
&lt;p&gt;SysSocket.lib&lt;/p&gt;
&lt;p&gt;SysTypes.lib&lt;/p&gt;
&lt;p&gt;CmpErrors.lib&lt;/p&gt;
&lt;p&gt;-----------------------  DECLARATION ------------------------------------&lt;/p&gt;
&lt;p&gt;VAR&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;My_Data&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ARRAY&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;..&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="n"&gt;OF&lt;/span&gt; &lt;span class="n"&gt;BYTE&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="o"&gt;];&lt;/span&gt;

&lt;span class="n"&gt;Socket_Create_Result&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;POINTER&lt;/span&gt; &lt;span class="n"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;RTS_IEC_RESULT&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;Socket_Create_Handle&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;RTS_IEC_HANDLE&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;bFirst&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;BOOL&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;TRUE&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;Socket_Send_Result&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;POINTER&lt;/span&gt; &lt;span class="n"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;RTS_IEC_RESULT&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;END_VAR&lt;/p&gt;
&lt;p&gt;-------------------------- CODE --------------------------------------------&lt;/p&gt;
&lt;p&gt;IF bFirst THEN&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;bFirst&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;FALSE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;Socket_Create_Handle&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;SysSockCreate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SOCKET_AF_INET&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SOCKET_DGRAM&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SOCKET_IPPROTO_UDP&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ADR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Socket_Create_Result&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;END_IF&lt;/p&gt;
&lt;p&gt;My_Data&lt;span&gt;[0]&lt;/span&gt; := My_Data&lt;span&gt;[0]&lt;/span&gt;+1;&lt;/p&gt;
&lt;p&gt;My_Data&lt;span&gt;[1]&lt;/span&gt; := My_Data&lt;span&gt;[1]&lt;/span&gt;+1;&lt;/p&gt;
&lt;p&gt;My_Data&lt;span&gt;[2]&lt;/span&gt; := My_Data&lt;span&gt;[2]&lt;/span&gt;+1;&lt;/p&gt;
&lt;p&gt;My_Data&lt;span&gt;[3]&lt;/span&gt; := My_Data&lt;span&gt;[3]&lt;/span&gt;+1;&lt;/p&gt;
&lt;p&gt;My_Data&lt;span&gt;[4]&lt;/span&gt; := My_Data&lt;span&gt;[4]&lt;/span&gt;+1;&lt;/p&gt;
&lt;p&gt;SysSockSendToUdp(&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;hSocketUdp&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;Socket_Create_Handle&lt;/span&gt;, &lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="nv"&gt;handle&lt;/span&gt; &lt;span class="nv"&gt;to&lt;/span&gt; &lt;span class="nv"&gt;socket&lt;/span&gt;

&lt;span class="nv"&gt;diPort&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;SysSockHtons&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;, &lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="nv"&gt;Socket&lt;/span&gt; &lt;span class="nv"&gt;to&lt;/span&gt; &lt;span class="k"&gt;send&lt;/span&gt; &lt;span class="nv"&gt;to&lt;/span&gt;

&lt;span class="nv"&gt;szDestAddress&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;192.168.1.200&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;,  &lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="nv"&gt;IP&lt;/span&gt; &lt;span class="nv"&gt;address&lt;/span&gt; &lt;span class="nv"&gt;to&lt;/span&gt; &lt;span class="k"&gt;send&lt;/span&gt; &lt;span class="nv"&gt;to&lt;/span&gt;

&lt;span class="nv"&gt;pbyData&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;ADR&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;My_Data&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;,  &lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="nv"&gt;Pointer&lt;/span&gt; &lt;span class="nv"&gt;to&lt;/span&gt; &lt;span class="nv"&gt;data&lt;/span&gt; &lt;span class="nv"&gt;array&lt;/span&gt;

&lt;span class="nv"&gt;diDataSize&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;,   &lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="nv"&gt;size&lt;/span&gt; &lt;span class="nv"&gt;of&lt;/span&gt; &lt;span class="nv"&gt;data&lt;/span&gt;

&lt;span class="nv"&gt;pResult&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;ADR&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;Socket_Send_Result&lt;/span&gt;&lt;span class="ss"&gt;))&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;</summary></entry><entry><title>Socket Connection</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/b21d332b46/?limit=25#205d" rel="alternate"/><published>2020-02-27T20:25:20.790000Z</published><updated>2020-02-27T20:25:20.790000Z</updated><author><name>orpheus</name><uri>https://forge.codesys.com/u/orpheus/</uri></author><id>https://forge.codesys.com46cf18ba9c33193aabe725ba3012ce07016e2a0c</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thanks Avgur for the answer.&lt;/p&gt;
&lt;p&gt;I'm Calling Codesys support to get password for the download area ........&lt;/p&gt;
&lt;p&gt;thanks again&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Socket Connection</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/b21d332b46/?limit=25#4db0" rel="alternate"/><published>2020-02-27T20:25:16.983000Z</published><updated>2020-02-27T20:25:16.983000Z</updated><author><name>Avgur</name><uri>https://forge.codesys.com/u/avgur/</uri></author><id>https://forge.codesys.comb487eb65392f3cdc926f8f3b7e75e10ac7944e97</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I have used only SysLibSockets library for Codesys 2.3. Try to find TcpIp example in Codesys FTP folder &lt;a class="" href="http://3s-software.com/index.shtml?sample_projects" rel="nofollow"&gt;http://3s-software.com/index.shtml?sample_projects&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;PS. Call Codesys support to get password for the download area.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Socket Connection</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/b21d332b46/?limit=25#49c5" rel="alternate"/><published>2020-02-27T20:25:15.622000Z</published><updated>2020-02-27T20:25:15.622000Z</updated><author><name>orpheus</name><uri>https://forge.codesys.com/u/orpheus/</uri></author><id>https://forge.codesys.com096f255c4de2fb95fe94e3b678f1d56b090bbf72</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Does anyone have experience using the Sockets library with TCP/IP and CoDeSys V3.3? I am trying to develop a TCP/IP application for the first time and I was wondering if  someone could post me an example about Client/Server Communication over CoDeSys V3.3.&lt;/p&gt;
&lt;p&gt;Thanks a lot&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>