//
//    libsocketcpp - a C++ class/library to allow easy TCP and UDP functionatliy
//    Copyright (C) 2001 Garrett Grice
//
//    This library is free software; you can redistribute it and/or
//    modify it under the terms of the GNU Lesser General Public
//    License as published by the Free Software Foundation; either
//    version 2 of the License, or (at your option) any later version.
//
//    This library is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//    Lesser General Public License for more details.
//
//    You should have received a copy of the GNU Lesser General Public
//    License along with this library; if not, write to the Free Software
//    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
//   see the file "AUTHORS" for contact information.
    


#ifndef _TCPSOCKET_H
#define _TCPSOCKET_H

#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>

#define TCP 'T'
#define UDP 'U'


class TCPSocket {

public:

	TCPSocket();
	~TCPSocket();

	bool Create();
        bool Create(char nType);
	bool Create(int nPort);
        bool Create(int nPort, char nType);

        bool Listen();
   
        bool Accept();
 
   
	bool Connect(int nPort, char *Hostname);

	int Send(const void *Message, int nLength);
	int Recv(void *Buffer, int nLength);

	bool Close();
        bool InboundClose();

private:

	int sockfd, newfd;
	sockaddr_in INetAddress, RemoteAddress;
	
};


#endif
