# TCP IP Scanner Losing Connection

**URL:** <https://discourse.nodered.org/t/tcp-ip-scanner-losing-connection/65010>\
**Category:** Industrial\
**Created:** [12 July 2022 15:51 UTC](https://discourse.nodered.org/t/tcp-ip-scanner-losing-connection/65010 "2022-07-12T15:51:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jts450](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@jts450](https://discourse.nodered.org/u/jts450)\
**Post date:** [12 July 2022 15:51 UTC](https://discourse.nodered.org/t/tcp-ip-scanner-losing-connection/65010/1 "2022-07-12T15:51:11Z")

</div>

I am having issues with losing my connection to a TCP IP barcode scanner on port 51240, It works for a while but then the node shows disconnected. Once i restart the scanner it so far always starts working again for x amount of time. I don't know if its a scanner problem or node-red setup issue.

My next step was to try a different TCP port but I am looking at other ideas on what could be the problem?

I should add I can always ping the IP address

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/1/51a883edc6929469a911ee6a5e95c66c7fec7a57.png)

```auto
[
    {
        "id": "29bdc5903ebe68f6",
        "type": "debug",
        "z": "ce6b5df784b18300",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 630,
        "y": 1320,
        "wires": []
    },
    {
        "id": "bd1ad3acab7aa002",
        "type": "tcp in",
        "z": "ce6b5df784b18300",
        "name": "",
        "server": "client",
        "host": "192.168.3.50",
        "port": "51240",
        "datamode": "stream",
        "datatype": "utf8",
        "newline": "",
        "topic": "",
        "base64": false,
        "tls": "",
        "x": 260,
        "y": 1380,
        "wires": [
            [
                "29bdc5903ebe68f6",
                "def1b3201abacdd7"
            ]
        ]
    },
    {
        "id": "897d351c07392aa1",
        "type": "inject",
        "z": "ce6b5df784b18300",
        "name": "Trigger Scan",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "T",
        "payloadType": "str",
        "x": 350,
        "y": 1000,
        "wires": [
            [
                "c177037e93d8721f"
            ]
        ]
    },
    {
        "id": "c177037e93d8721f",
        "type": "tcp out",
        "z": "ce6b5df784b18300",
        "name": "",
        "host": "192.168.3.50",
        "port": "51240",
        "beserver": "client",
        "base64": false,
        "end": false,
        "tls": "",
        "x": 950,
        "y": 1040,
        "wires": []
    },
    {
        "id": "d5e98b7e8b1be7f6",
        "type": "debug",
        "z": "ce6b5df784b18300",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 630,
        "y": 1440,
        "wires": []
    },
    {
        "id": "c215f2c24b011534",
        "type": "inject",
        "z": "ce6b5df784b18300",
        "d": true,
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": ".1",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 110,
        "y": 1080,
        "wires": [
            [
                "05fa8750989cf4a0"
            ]
        ]
    },
    {
        "id": "05fa8750989cf4a0",
        "type": "MC Read",
        "z": "ce6b5df784b18300",
        "name": "M500",
        "topic": "",
        "connection": "8bf9ce709d0bac70",
        "address": "M500",
        "addressType": "str",
        "outputFormat": "1",
        "errorHandling": "throw",
        "outputs": 1,
        "x": 330,
        "y": 1080,
        "wires": [
            [
                "bf36fdbf8698e642"
            ]
        ]
    },
    {
        "id": "0ba908b7db09b02b",
        "type": "inject",
        "z": "ce6b5df784b18300",
        "d": true,
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": ".1",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 330,
        "y": 900,
        "wires": [
            [
                "813eb785272c477e"
            ]
        ]
    },
    {
        "id": "813eb785272c477e",
        "type": "MC Read",
        "z": "ce6b5df784b18300",
        "name": "Y5",
        "topic": "",
        "connection": "8bf9ce709d0bac70",
        "address": "Y5",
        "addressType": "str",
        "outputFormat": "1",
        "errorHandling": "throw",
        "outputs": 1,
        "x": 530,
        "y": 900,
        "wires": [
            [
                "bdf70248f339d761"
            ]
        ]
    },
    {
        "id": "bdf70248f339d761",
        "type": "debug",
        "z": "ce6b5df784b18300",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 710,
        "y": 900,
        "wires": []
    },
    {
        "id": "06b901db64270eaf",
        "type": "comment",
        "z": "ce6b5df784b18300",
        "name": "Manual Scanner Trigger",
        "info": "",
        "x": 320,
        "y": 960,
        "wires": []
    },
    {
        "id": "48d9231513041a71",
        "type": "comment",
        "z": "ce6b5df784b18300",
        "name": "Scanner Data",
        "info": "",
        "x": 250,
        "y": 1340,
        "wires": []
    },
    {
        "id": "7d1f8edd0f0ccc65",
        "type": "function",
        "z": "ce6b5df784b18300",
        "name": "If True Return T",
        "func": "if(msg.payload == true)\n{\n msg.payload = 'T'\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 640,
        "y": 1080,
        "wires": [
            [
                "c177037e93d8721f"
            ]
        ]
    },
    {
        "id": "20266a9bbd51a1a7",
        "type": "comment",
        "z": "ce6b5df784b18300",
        "name": "PLC Scanner Trigger",
        "info": "",
        "x": 320,
        "y": 1040,
        "wires": []
    },
    {
        "id": "bf36fdbf8698e642",
        "type": "rbe",
        "z": "ce6b5df784b18300",
        "name": "",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload",
        "topi": "topic",
        "x": 470,
        "y": 1080,
        "wires": [
            [
                "7d1f8edd0f0ccc65"
            ]
        ]
    },
    {
        "id": "8bf9ce709d0bac70",
        "type": "MC Protocol Connection",
        "name": "PLC1",
        "host": "192.168.3.39",
        "port": "3001",
        "protocol": "UDP",
        "frame": "3E",
        "plcType": "Q",
        "ascii": false,
        "PLCStation": "",
        "PCStation": "",
        "PLCModuleNo": "",
        "network": "",
        "octalInputOutput": false,
        "timeout": "1000"
    }
]type or paste code here

```

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [12 July 2022 16:04 UTC](https://discourse.nodered.org/t/tcp-ip-scanner-losing-connection/65010/2 "2022-07-12T16:04:23Z")

</div>

Is the scanner maybe going into power saving mode?

---

<div class="post-metadata">

**Author:** ![jts450](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@jts450](https://discourse.nodered.org/u/jts450)\
**Post date:** [12 July 2022 16:20 UTC](https://discourse.nodered.org/t/tcp-ip-scanner-losing-connection/65010/3 "2022-07-12T16:20:24Z")

</div>

I don't believe so but I can check the software and configuration

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 September 2022 16:20 UTC](https://discourse.nodered.org/t/tcp-ip-scanner-losing-connection/65010/4 "2022-09-10T16:20:41Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
