www.pudn.com > FTPServerClient.zip > tcp.h


#ifndef TCP_H_ 
#define TCP_H_ 
 
#include  
#include  
 
class Tcp { 
public: 
	enum DataType { 
		ASCII, 
		EBCDIC,		// not implemented 
		IMAGE, 
		LOCAL		// not implemented 
	}; 
 
	~Tcp(); 
 
	void setDataType(DataType type); 
 
	std::string read(); 
	void readToStream(std::ostream& os); 
 
	void write(const std::string& buf); 
	void writeFromStream(std::istream& is); 
 
	int getLocalAddr(); 
	int getLocalPort(); 
 
private: 
	friend class TcpFactory; 
	Tcp(int sock); 
 
	int sockfd; 
	DataType dataType; 
	int localAddr; 
	int localPort; 
	std::string buffer; 
	unsigned int pos; 
	bool eof; 
}; 
 
#endif /*TCP_H_*/