These are just some modules I wrote up, basic, but pretty full proof.

If there are any errors I'm sorry. I spent quite some time working the bugs out, although it may not seem like I have, I was learning as I was going.

Anyways, here's a demonstration video on what they do etc.



And here is the code :

If you use it, please say thanks or something ui:

TCPClient.cs :
PHP Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;

namespace 
TCP_Modules
{
    class 
TCPClient
    
{
        
#region Declarations
        
static TcpClient Client = new TcpClient();
        static 
NetworkStream CStream;
        static 
ASCIIEncoding CEncode = new ASCIIEncoding();
        
#endregion

        
public static Boolean Connect(String IPAddressint Port)
        {
            try
            {
                
Client.Connect(IPAddressPort);
                if (
Client.Connected != false)
                {
                    
CStream Client.GetStream();
                    return 
true;
                }
                else
                {
                    return 
false;
                }
            }
            catch (
Exception Ex)
            {
                return 
false;
            }
        }
        public static 
String GetData()
        {
            if (
CStream.DataAvailable)
            {
                
Byte[] = new Byte[1024];
                
int b 0;
                try
                {
                    
StringBuilder StringBuild = new StringBuilder();
                    
CStream.Read(A0A.Length);
                    
StringBuild.AppendFormat("{0}"Encoding.ASCII.GetString(A0b));
                    
CStream.Flush();
                    return 
StringBuild.ToString();
                }
                catch (
Exception Ex)
                {
                    return 
null;
                }
            }
            else
            {
                return 
null;
            }
        }
        public static 
Boolean Disconnect()
        {
            try
            {
                
Client.Close();
                if (
Client.Connected != true)
                {
                    return 
true;
                }
                else
                {
                    return 
false;
                }
            }
            catch (
Exception Ex)
            {
                return 
false;
            }
        }
        public static 
void SendData(String Data)
        {
            
Byte[] Sending CEncode.GetBytes(Data);
            
CStream.Write(Sending0Sending.Length);
        }
    }

TCPServer.cs :
PHP Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;
using System.IO;

namespace 
TCP_Modules
{
    class 
TCPServer
    
{
        static 
int Port 2143;
        static 
TcpListener Server;
        static 
TcpClient AServer;
        static 
NetworkStream ServerStream;
        static 
ASCIIEncoding SEncode = new ASCIIEncoding();

        public static 
Boolean ListenAccept()
        {
            if (
Server.Pending() == true)
            {
                
AServer Server.AcceptTcpClient();
                
ServerStream AServer.GetStream();
                return 
true;
            }
            return 
false;
        }

        public static 
void Start()
        { 
            
Server = new TcpListener(IPAddress.AnyPort);
            
Server.Start();
        }

        public static 
void SetPort(int PortNum)
        {
            
Port PortNum;
        }
        public static 
String GetData()
        {
            if (
ServerStream.DataAvailable)
            {
                
Byte[] = new Byte[1024];
                
int b 0;
                try
                {
                    
StringBuilder StringBuild = new StringBuilder();
                    
ServerStream.Read(A0A.Length);
                    
StringBuild.AppendFormat("{0}"Encoding.ASCII.GetString(A0b));
                    
ServerStream.Flush();
                    return 
StringBuild.ToString();
                }
                catch (
Exception Ex)
                {
                    return 
null;
                }
            }
            else
            {
                return 
null;
            }
        }
        public static 
Boolean IsConnected()
        {
            if (
AServer.Connected == true)
            {
                return 
true;
            }
            else
            {
                return 
false;
            }
        }
        public static 
void SendData(String Data)
        {
            
Byte[] Sending SEncode.GetBytes(Data);
            
ServerStream.Write(Sending0Sending.Length);
        }
    }

You can remove the namespaces if you want, it makes no difference.