I'm trying to collect data from a IP Address and Port using a TCP Client or a socket, but can't seem to find a way to successfully write what I receive to either the Console or to a file. Of the numerous sources I've sifted through online including MSDN documentation and various blogs, I found this one to be the most understandable, yet it still doesn't write anything to the console and I know the IP Address / Port (which I can't share) is supposed to be sending me a stream of data.
What am I doing wrong?
using System;
using System.Net;
using System.Net.Sockets;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
namespace TCPIPChallenge
{
    public class Program
    {
        public static void Main(string[] args)
        {
            Client client = new Client();
            client.SetupServer();
        }
    }
    public class Client
    {
        private Socket _clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        private byte[] _recieveBuffer = new byte[8142];
        private void SetupServer()
        {
            try
        {
            _clientSocket.Connect(new IPEndPoint(IPAddress.Parse("0.0.0.0"), 8888));
            Console.WriteLine("It was successful!");
        }
        catch (SocketException ex)
        {
            Console.WriteLine("There was an issue...");
            Debug.Write(ex.Message);
        }
        Console.WriteLine(_clientSocket.Connected);
        _clientSocket.BeginReceive(_recieveBuffer, 0, _recieveBuffer.Length, SocketFlags.None, new AsyncCallback(ReceiveCallback), null);
    }
    private void ReceiveCallback(IAsyncResult AR)
    {
        //Check how much bytes are recieved and call EndRecieve to finalize handshake
        int recieved = _clientSocket.EndReceive(AR);
        Console.WriteLine(_clientSocket.Connected);
        if (recieved <= 0)
            return;
            //Copy the recieved data into new buffer , to avoid null bytes
            byte[] recData = new byte[recieved];
            Buffer.BlockCopy(_recieveBuffer, 0, recData, 0, recieved);
            //Process data here the way you want , all your bytes will be stored in recData
            Console.WriteLine(recData.ToString());
            //Start receiving again
            _clientSocket.BeginReceive(_recieveBuffer, 0, _recieveBuffer.Length, SocketFlags.None, new AsyncCallback(ReceiveCallback), null);
        }
    }
}
 
     
    