My Project
|
00001 #ifndef ACQUIRENEUTRONSOURCEINFORMATIONBASE 00002 #define ACQUIRENEUTRONSOURCEINFORMATIONBASE 00003 00004 #define BUFSIZE 4096 00005 00006 //#include <stdio> 00007 //#include <stdlib> 00008 #include <unistd.h> /* getopt, optarg, sleep */ 00009 #include <netdb.h> /* gethostbyname() */ 00010 00011 #include <sys/types.h> /* protocol family, opendir */ 00012 #include <sys/socket.h> /* socket system call */ 00013 #include <sys/select.h> /* select system call */ 00014 #include <sys/param.h> 00015 #include <sys/stat.h> /* mkdir */ 00016 00017 #include <netinet/in.h> /* struct sockaddr_in */ 00018 #include <arpa/inet.h> /* inet_aton() */ 00019 #include <dirent.h> /* opendir */ 00020 00021 //#include <iostream> 00022 #include <sstream> 00023 //#include <string> /* strncpy() */ 00024 00025 #include "Header.hh" 00026 00028 class AcquireNeutronSourceInformationBase 00029 { 00030 private: 00031 protected: 00032 string HostName; /* host name */ 00033 string FilePath; /* file path */ 00034 00035 struct sockaddr_in sin; /* The structure for socket */ 00036 // struct hostent *ServHost; /* The structure for host name and IP address */ 00037 // struct servent *Service; /* The structure for service */ 00038 Int4 SocketDescriptor; /* Socket descriptor */ 00039 public: 00040 AcquireNeutronSourceInformationBase(); 00042 00044 AcquireNeutronSourceInformationBase( string host_name ); 00046 00049 virtual ~AcquireNeutronSourceInformationBase(); 00051 00054 void SetHostName( const string host_name ); 00055 void SetFilePath( const string file_path ); 00056 string PutHostName(); 00057 string PutFilePath(); 00058 00059 Int4 InitializeSockaddrIn (); 00060 Int4 CreateSocket (); 00061 Int4 ServerConnect (); 00062 void SocketClose (); 00063 00064 Int4 SendRequset (string& request); 00065 Int4 RecvReply (string& recv_data); 00066 Int4 SplitBodyData (string& recv_data, string& body_data); 00067 //Int4 SplitBodyData (const string Mode, string& recv_data, string& body_data); 00068 }; 00069 00070 #endif