{"id":1476,"date":"2023-02-07T19:03:12","date_gmt":"2023-02-07T10:03:12","guid":{"rendered":"https:\/\/twarelab.com\/?p=1476"},"modified":"2023-02-07T19:04:01","modified_gmt":"2023-02-07T10:04:01","slug":"4ch-s2e-tw100xx-tcp-server-mode-tutorial","status":"publish","type":"post","link":"https:\/\/twarelab.com\/en\/blog\/4ch-s2e-tw100xx-tcp-server-mode-tutorial\/","title":{"rendered":"[4CH S2E] TW100xx &#8211; TCP Server Mode Tutorial"},"content":{"rendered":"<h2 class=\"wp-block-heading\">TCP Server Mode<\/h2>\n\n\n\n<p>The parameter values for setting TW100 to TCP Server Mode are as follows:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Operation Mode: Server Mode<\/li>\n\n\n\n<li>Communication Parameter \n<ul class=\"wp-block-list\">\n<li>Local Port: 5000<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>With these settings, TW100 opens a TCP Server Socket with the local port number and waits for a connection from a TCP Client.<\/p>\n\n\n\n<p>An example of a setting screen using the configuration tool is as follows.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"993\" src=\"http:\/\/twarelab.com\/wp-content\/uploads\/2023\/02\/tcp_server_setting_example-1024x993.png\" alt=\"\" class=\"wp-image-1480\" srcset=\"https:\/\/twarelab.com\/wp-content\/uploads\/2023\/02\/tcp_server_setting_example-1024x993.png 1024w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/02\/tcp_server_setting_example-600x582.png 600w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/02\/tcp_server_setting_example-300x291.png 300w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/02\/tcp_server_setting_example-768x745.png 768w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/02\/tcp_server_setting_example-12x12.png 12w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/02\/tcp_server_setting_example.png 1163w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>This is the setup screen for sending data assigned to UART Channel 1 through TCP\/IP. When the Operation mode is set to &#8220;Server mode&#8221;, it is configured as a TCP Server mode and waits for a TCP connection.<\/p>\n\n\n\n<p>Once the TCP connection is established, the data coming in from UART Channel 1 is transmitted through the TCP\/IP network via this connection. Conversely, data incoming from the TCP connection is transmitted to UART Channel 1.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Checking Operation<\/h2>\n\n\n\n<p>Let&#8217;s check the actual operation now. We&#8217;ll use the Hercules TCP\/IP communication test tool mentioned earlier.<\/p>\n\n\n\n<p>First, run Hercules and attempt a TCP connection. Use the values set above.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"448\" src=\"http:\/\/twarelab.com\/wp-content\/uploads\/2022\/11\/image-4-1024x448.png\" alt=\"\" class=\"wp-image-410\" srcset=\"https:\/\/twarelab.com\/wp-content\/uploads\/2022\/11\/image-4-1024x448.png 1024w, https:\/\/twarelab.com\/wp-content\/uploads\/2022\/11\/image-4-600x263.png 600w, https:\/\/twarelab.com\/wp-content\/uploads\/2022\/11\/image-4-300x131.png 300w, https:\/\/twarelab.com\/wp-content\/uploads\/2022\/11\/image-4-768x336.png 768w, https:\/\/twarelab.com\/wp-content\/uploads\/2022\/11\/image-4-18x8.png 18w, https:\/\/twarelab.com\/wp-content\/uploads\/2022\/11\/image-4-1200x525.png 1200w, https:\/\/twarelab.com\/wp-content\/uploads\/2022\/11\/image-4.png 1257w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Hercules TCP Client setting<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, run Hercules and try to establish a TCP connection. Use the values set earlier.<\/li>\n\n\n\n<li>Select the TCP Client tab, enter the TCP Server address and port information, <\/li>\n\n\n\n<li>And press the Connect button to complete.<\/li>\n<\/ul>\n\n\n\n<p>Now you can verify that the data sent will be received by TW100xx UART Channel 1. The reverse case also works well.<\/p>\n\n\n\n<p>It is recommended to apply the same process to UART Channel 2, 3, and 4 for testing.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Caution!<\/h2>\n\n\n\n<p>It&#8217;s possible to assign the same port number, but this makes it difficult to determine which UART Channel is connected to the TCP Client. Therefore, it is recommended to give each a different server port number.<\/p>\n\n\n\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>TCP Server Mode The parameter values for setting TW100 to TCP Server Mode are as follows: With these settings, TW100 opens a TCP Server Socket with the local port number and waits for a connection from a TCP Client. An example of a setting screen using the configuration tool is [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_themeisle_gutenberg_block_has_review":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1,13],"tags":[],"class_list":["post-1476","post","type-post","status-publish","format-standard","hentry","category-blog","category-en"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/twarelab.com\/en\/wp-json\/wp\/v2\/posts\/1476","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/twarelab.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/twarelab.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/twarelab.com\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/twarelab.com\/en\/wp-json\/wp\/v2\/comments?post=1476"}],"version-history":[{"count":1,"href":"https:\/\/twarelab.com\/en\/wp-json\/wp\/v2\/posts\/1476\/revisions"}],"predecessor-version":[{"id":1482,"href":"https:\/\/twarelab.com\/en\/wp-json\/wp\/v2\/posts\/1476\/revisions\/1482"}],"wp:attachment":[{"href":"https:\/\/twarelab.com\/en\/wp-json\/wp\/v2\/media?parent=1476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/twarelab.com\/en\/wp-json\/wp\/v2\/categories?post=1476"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/twarelab.com\/en\/wp-json\/wp\/v2\/tags?post=1476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}