Python - read json object over TCP connection (using regex?)
<p>My client sends json objects over TCP. Each object is with the following form:</p>

<pre><code>{
       "message" =&gt; "{\"timestamp\":\"2016-07-21T01:20:04.392799-0400\",\"in_iface\":\"docker0\",\"event_type\":\"alert\",\"src_ip\":\"172.17.0.2\",\"dest_ip\":\"172.17.0.3\",\"proto\":\"ICMP\",\"icmp_type\":0,\"icmp_code\":0,\"alert\":{\"action\":\"allowed\",\"gid\":2,\"signature_id\":2,\"rev\":0,\"signature\":\"ICMP msg\",\"category\":\"\",\"severity\":3},\"payload\":\"hFuQVwAA\",\"payload_printable\":\"kk\"}",
      "@version" =&gt; "1",
    "@timestamp" =&gt; "2016-07-25T04:41:11.980Z",
          "path" =&gt; "/etc/logstash/jsonSample.log",
          "host" =&gt; "baklava",
           "doc" =&gt; {
                "timestamp" =&gt; "2016-07-21T01:20:04.392799-0400",
                 "in_iface" =&gt; "docker0",
               "event_type" =&gt; "alert",
                   "src_ip" =&gt; "172.17.0.2",
                  "dest_ip" =&gt; "172.17.0.3",
                    "proto" =&gt; "ICMP",
                "icmp_type" =&gt; 0,
                "icmp_code" =&gt; 0,
                    "alert" =&gt; {
                  "action" =&gt; "allowed",
                     "gid" =&gt; 2,
            "signature_id" =&gt; 2,
                     "rev" =&gt; 0,
               "signature" =&gt; "ICMP msg",
                "category" =&gt; "",
                "severity" =&gt; 3
        },
                  "payload" =&gt; "hFuQVwAA",
        "payload_printable" =&gt; "kk"
    },
     "alert.gid" =&gt; 2,
          "tags" =&gt; [
        [0] "tagName_2"
    ]
}
</code></pre>

<p>I'd like to write a python server that listent to port 11111 , and is able to get such objects and parse them seperately.</p>

<p>Can anyone help with a complete code?</p>

<p>Thanks a lot!</p>