<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[REXYGEN Community Forum / REXLANG a TCP client]]></title>
	<link rel="self" href="https://www.rexygen.com/oldforum/extern.php?action=feed&amp;tid=402&amp;type=atom"/>
	<link href="http://www.rexygen.com/oldforum/viewtopic.php?id=402"/>
	<updated>2017-11-10T11:04:39Z</updated>
	<generator>FluxBB</generator>
	<id>http://www.rexygen.com/oldforum/viewtopic.php?id=402</id>
	<entry>
		<title type="html"><![CDATA[Re: REXLANG a TCP client]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=1809#p1809"/>
		<content type="html"><![CDATA[<p>Díky,<br />teď už to funguje.</p>]]></content>
		<author>
			<name><![CDATA[arthurkuk]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=174</uri>
		</author>
		<updated>2017-11-10T11:04:39Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=1809#p1809</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: REXLANG a TCP client]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=1808#p1808"/>
		<content type="html"><![CDATA[<p>Dobrý den,<br />zkuste změnit parametr strs bloku REXLANG na 32768, to by mohlo pomoci. Smůlu určitě nemáte, nějaké řešení najdeme.</p><p>S pozdravem<br />Jaroslav Sobota</p>]]></content>
		<author>
			<name><![CDATA[jaroslav_sobota]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=3</uri>
		</author>
		<updated>2017-11-10T10:40:49Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=1808#p1808</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: REXLANG a TCP client]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=1806#p1806"/>
		<content type="html"><![CDATA[<p>Nový poznatek:<br />poslední velikost při které to funguje je 2047, mám asi smůlu.</p>]]></content>
		<author>
			<name><![CDATA[arthurkuk]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=174</uri>
		</author>
		<updated>2017-11-10T10:07:32Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=1806#p1806</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[REXLANG a TCP client]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=1805#p1805"/>
		<content type="html"><![CDATA[<p>Dobrý den,<br />chtěl bych se zeptat jestli je nějaké omezení velikosti bufferu ve funkci &quot;Read&quot; pro TCP clienta. Pokud zvolím velikost bufferu 2048, tak to vypadá, že se stopne provádění bloku REXLANG při prvním pokusu o provedení funkce &quot;Read&quot;. Zkusmo jsem ho zmenšil na 255 a to funguje, ale já bych potřeboval 2048.<br />Díky.</p><p>Tady je kód:</p><p>#define ipadr&#160; &#160; &quot;192.168.0.7&quot;<br />#define pport&#160; &#160; 5002<br />#define bufout&#160; &#160; 7<br />#define bufin&#160; &#160; 2048</p><p>//assigning inputs to variables, these variables are READ-ONLY<br />double input(0) firstinput; //value from u0 input<br />double input(1) secondinput; //value from u1 input<br />//add inputs as needed</p><p>//assigning parameters to variables, these variables are READ-ONLY<br />double parameter(0) firstparameter; //parameter p0<br />double parameter(1) secondparameter; //parameter p1<br />//add parameters as needed</p><p>//assigning variables to outputs, these variables are WRITE-ONLY<br />long output(15) handle;&#160; &#160; //handle of the UDP socket<br />long output(14) dataPrij;&#160; &#160; //handle of the UDP socket<br />long output(13) dataVys;&#160; &#160; //handle of the UDP socket<br />long output(12) citSendErr;&#160; &#160; //handle of the UDP socket<br />long output(11) citCykl;&#160; &#160; //handle of the UDP socket<br />long output(0) vystup0; //value to send to y0 output<br />double output(1) secondoutput; //value to send to y1 output<br />//add output signals as needed</p><p>long hSendLoc;&#160; &#160; &#160; &#160; &#160; &#160; &#160;//socket handle<br />long buffwr[bufout];&#160; //buffer for incoming data<br />long buffre[bufin];&#160; //buffer for incoming data<br />long dataCnt;&#160; &#160; &#160; &#160; &#160; &#160; &#160; //number of bytes sent<br />long dataCnt2;&#160; &#160; &#160; &#160; &#160; &#160; &#160; //number of bytes sent<br />long odeslano;<br />long prijato;<br />//long dataPrij;&#160; &#160; &#160; &#160; &#160; &#160; &#160; //number of bytes receive<br />long convData[2];&#160; &#160; &#160; &#160; &#160; //array for data conversions</p><p>//the init procedure is executed once when the REXLANG function block initializes<br />long init(void)<br />{<br />&#160; &#160; /* PUT YOUR CODE HERE */<br />&#160; &#160; hSendLoc=-1;<br />&#160; &#160; odeslano=0;<br />&#160; &#160; prijato=-1;<br />&#160; &#160; //citSendErr=0;<br />&#160; &#160; return 0;<br />}</p><p>//the main procedure is executed repeatedly (once in each sampling period)<br />long main(void)<br />{<br />&#160; &#160; /* PUT YOUR CODE HERE */<br />&#160; &#160; //firstoutput = firstinput + secondinput;<br />&#160; &#160; //secondoutput = firstparameter + secondparameter;<br />&#160; &#160; if(hSendLoc&lt;0){<br />&#160; &#160; &#160; &#160; hSendLoc=OpenTCPcli(ipadr,pport);<br />&#160; &#160; }<br />&#160; &#160; else{<br />&#160; &#160; &#160; &#160; //dataCnt2=Read(hSendLoc,buffre,bufin);<br />&#160; &#160; &#160; &#160; buffwr[0]=&#039;X&#039;;<br />&#160; &#160; &#160; &#160; buffwr[1]=&#039;x&#039;;<br />&#160; &#160; &#160; &#160; buffwr[2]=&#039;x&#039;;<br />&#160; &#160; &#160; &#160; buffwr[3]=&#039;x&#039;;<br />&#160; &#160; &#160; &#160; buffwr[4]=&#039;x&#039;;<br />&#160; &#160; &#160; &#160; buffwr[5]=13;<br />&#160; &#160; &#160; &#160; buffwr[6]=10;<br />&#160; &#160; &#160; &#160; if(odeslano==0){<br />&#160; &#160; &#160; &#160; &#160; &#160; dataCnt=Write(hSendLoc,buffwr,bufout);<br />&#160; &#160; &#160; &#160; &#160; &#160; odeslano=1;<br />&#160; &#160; &#160; &#160; }<br />&#160; &#160; &#160; &#160; else{<br />&#160; &#160; &#160; &#160; &#160; &#160; dataCnt2=Read(hSendLoc,buffre,bufin);<br />&#160; &#160; &#160; &#160; &#160; &#160; citSendErr++;<br />&#160; &#160; &#160; &#160; &#160; &#160; if(dataCnt2&gt;0){<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; odeslano=0;<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; citSendErr=0;<br />&#160; &#160; &#160; &#160; &#160; &#160; }<br />&#160; &#160; &#160; &#160; }<br />&#160; &#160; &#160; &#160; //odeslano=1;<br />&#160; &#160; &#160; &#160; dataVys=dataCnt;<br />&#160; &#160; &#160; &#160; dataPrij=dataCnt2;<br />&#160; &#160; &#160; &#160; if(dataVys==-309){<br />&#160; &#160; &#160; &#160; &#160; &#160; Close(hSendLoc);<br />&#160; &#160; &#160; &#160; &#160; &#160; hSendLoc=-1;<br />&#160; &#160; &#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; }<br />&#160; &#160; &#160; &#160; //dataCnt2=Read(hSendLoc,buffre,bufin);<br />&#160; &#160; &#160; &#160; //vystup0=buffre[1910]*256+buffre[1911];<br />&#160; &#160; }<br />&#160; &#160; handle=hSendLoc;<br />&#160; &#160; citCykl++;<br />&#160; &#160; return 0;<br />}</p><p>//the exit procedure is executed once when the task is correctly terminated<br />// (system shutdown, downloading new control algorithm, etc.)<br />long exit(void)<br />{<br />&#160; &#160; if(hSendLoc&gt;=0) Close(hSendLoc);<br />&#160; &#160; return 0;<br />}</p>]]></content>
		<author>
			<name><![CDATA[arthurkuk]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=174</uri>
		</author>
		<updated>2017-11-10T10:02:50Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=1805#p1805</id>
	</entry>
</feed>
