Receiving Data from Pathology Machine using Socket

I am very new in Socket Programming. I am using the following code to receive incoming data from a pathology machine.

Issue I am facing...

  1. Machine is sending huge amount of data and gets busy and disconnects from program after some time.

  2. How can I start receiving data again? Is there any receiving event which fires automatically for incoming data?

byte[] buffer = new byte[2048];

        IPAddress ipAddress = IPAddress.Parse(SERVER_IP);
        IPEndPoint localEndpoint = new IPEndPoint(ipAddress, PORT_NO);

        Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        try
        {
            sock.Connect(localEndpoint);
        }
        catch (Exception ex)
        {
            throw ex;
        }

        while (true)
        {                
            int bytesRec = sock.Receive(buffer);
            data += Encoding.ASCII.GetString(buffer, 0, bytesRec);
            if (data.IndexOf("<EOF>") > -1)
            {
                break;
            }
        }