Python Socket is receiving inconsistent messages from Server
<p>So I am very new to networking and I was using the Python <a href="https://wiki.python.org/moin/TcpCommunication" rel="nofollow">Socket</a> library to connect to a server that is transmitting a stream of location data. </p>

<p>Here is the code used.</p>

<pre><code>import socket

BUFFER_SIZE = 1024
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((gump.gatech.edu, 756))

try:
    while (1):
        data = s.recv(BUFFER_SIZE).decode('utf-8')
        print(data)
except KeyboardInterrupt:
    s.close()
</code></pre>

<p>The issue is that the data arrives in inconsistent forms.</p>

<p>Most of the times it arrives in the correct form like this:</p>

<pre><code>2016-01-21 22:40:07,441,-84.404153,33.778685,5,3
</code></pre>

<p>Yet other times it can arrive split up into two lines like so:</p>

<pre><code>2016-01-21

22:40:07,404,-84.396004,33.778085,0,0
</code></pre>

<p>The interesting thing is that when I establish a raw connection to the server using Putty I only get the correct form and never the split. So I imagine that there must be something happening that is splitting the message. Or something Putty is doing to always assemble it correctly. </p>

<p>What I need is for the variable <code>data</code> to contain the proper line always. Any idea how to accomplish this?</p>