I've made a little change on SocketUnit from Aphex to make it more easy to use. Try and tell me how you feel it. Don't forget to give me credits

Here's the code:
Code:
{
  SocketUnitEx.pas
  Original unit by Aphex (unremote@knology.net)
  Modified by Wr #!d3 (Wrh1d3@gmail.com)
}

unit SocketUnitEx;

interface

uses
  Windows, Winsock;

type
  TClientSocket = class(TObject)
  private
    FSocket: TSocket;
    FHost: PChar;
    FPort: Word;
    FConnected: Boolean;
  public
    constructor Create(Host: string; Port: Word);
    destructor Destroy; override;
    procedure Connect;
    function LocalAddress: string;
		function RemoteAddress: string;
		function LocalPort: Word;
    function RemotePort: Word;
    function SendBuffer(var Buffer; BufferSize: Integer): Integer;
    function RecvBuffer(var Buffer; BufferSize: Integer): Integer;
    function SendText(const Text: string): Integer;   
    function ReceiveText: string;
    property Socket: TSocket read FSocket;
    property Connected: Boolean read FConnected;
  end;

implementation

constructor TClientSocket.Create(Host: string; Port: Word);
var
  WSAData: TWSAData;
begin    
  WSAStartup($0101, WSAData);
  FSocket := 0;
  FConnected := False;
  FHost := PChar(Host);
  FPort := Port;
end;

destructor TClientSocket.Destroy;
begin
  inherited Destroy;
  closesocket(FSocket);
  FConnected := False;
  WSACleanup();
end;

procedure TClientSocket.Connect;
var
  SockAddrIn: TSockAddrIn;
  HostEnt: PHostEnt;
begin
  FSocket := WinSock.socket(AF_INET, SOCK_STREAM, 0);
  SockAddrIn.sin_family := AF_INET;
  SockAddrIn.sin_port := htons(FPort);
  SockAddrIn.sin_addr.S_addr := inet_addr(FHost);
	
  if SockAddrIn.sin_addr.s_addr = INADDR_NONE then
  begin
    HostEnt := gethostbyname(FHost);
    if HostEnt = nil then Exit;
    SockAddrIn.sin_addr.s_addr := Longint(PLongint(HostEnt^.h_addr_list^)^);
  end;
	
  if WinSock.connect(FSocket, SockAddrIn, SizeOf(SockAddrIn)) = 0 then FConnected := True;
end;

function TClientSocket.LocalAddress: string;
var
  SockAddrIn: TSockAddrIn;
  Size: integer;
begin
  Size := sizeof(SockAddrIn);
  getsockname(FSocket, SockAddrIn, Size);
  Result := inet_ntoa(SockAddrIn.sin_addr);
end;

function TClientSocket.RemoteAddress: string;
var
  SockAddrIn: TSockAddrIn;
  Size: Integer;
begin
  Size := sizeof(SockAddrIn);
  getpeername(FSocket, SockAddrIn, Size);
  Result := inet_ntoa(SockAddrIn.sin_addr);
end;

function TClientSocket.LocalPort: Word;
var
  SockAddrIn: TSockAddrIn;
  Size: Integer;
begin
  Size := sizeof(SockAddrIn);
  getsockname(FSocket, SockAddrIn, Size);
  Result := ntohs(SockAddrIn.sin_port);
end;

function TClientSocket.RemotePort: Word;
var
  SockAddrIn: TSockAddrIn;
  Size: Integer;
begin
  Size := sizeof(SockAddrIn);
  getpeername(FSocket, SockAddrIn, Size);
  Result := ntohs(SockAddrIn.sin_port);
end;

function TClientSocket.SendBuffer(var Buffer; BufferSize: Integer): Integer;
begin
  Result := send(FSocket, Buffer, BufferSize, 0);
end;
   
function TClientSocket.RecvBuffer(var Buffer; BufferSize: Integer): Integer;
begin
  if BufferSize = -1 then ioctlsocket(FSocket, FIONREAD, Longint(Result)) else
  Result := recv(FSocket, Buffer, BufferSize, 0);
end;

function TClientSocket.SendText(const Text: string): Integer;
begin
  Result := SendBuffer(Pointer(Text)^, Length(Text));
end;
  
function TClientSocket.ReceiveText: string;
begin
  SetLength(Result, RecvBuffer(Pointer(nil)^, -1));
  SetLength(Result, RecvBuffer(Pointer(Result)^, Length(Result)));
end;

end.