-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Header: FGfdmSocket.h
Author: Jon S. Berndt
--------------------------------------------------------------------------------
11/08/99 JSB Created
-********************************************************************************
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#ifndef FGfdmSocket_H
#define FGfdmSocket_H
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
COMMENTS, REFERENCES, and NOTES
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
INCLUDES
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#include <stdlib.h>
#include <stdio.h>
#ifdef FGFS
-# pragma message("FGFS defined")
# include <simgear/compiler.h>
# include STL_STRING
-# ifdef FG_HAVE_STD_INCLUDES
-# include <fstream>
-# include <iostream>
-# else
-# include <fstream.h>
-# include <iostream.h>
+# include STL_IOSTREAM
+# include STL_FSTREAM
+# if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
+ SG_USING_STD(cout);
+ SG_USING_STD(endl);
# endif
- FG_USING_STD(string);
#else
-# pragma message("FGFS not defined")
# include <string>
-# include <fstream>
-# include <iostream>
+# if defined(sgi) && !defined(__GNUC__)
+# include <iostream.h>
+# include <fstream.h>
+# else
+# include <iostream>
+# include <fstream>
+ using std::cout;
+ using std::endl;
+# endif
#endif
#include <sys/types.h>
+#include "FGJSBBase.h"
-#if defined(__BORLANDC__) || defined(_MSC_VER)
+#if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__)
#include <winsock.h>
#else
#include <sys/socket.h>
#include <errno.h>
#endif
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+#define ID_FDMSOCKET "$Id$"
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-using namespace std;
+using std::string;
-class FGfdmSocket {
+class FGfdmSocket : public FGJSBBase
+{
public:
FGfdmSocket(string, int);
- ~FGfdmSocket(void);
+ ~FGfdmSocket();
void Send(void);
void Append(const char*);
- void Append(float);
+ void Append(double);
void Append(long);
void Clear(void);
+ bool GetConnectStatus(void) {return connected;}
private:
int sckt;
struct sockaddr_in scktName;
struct hostent *host;
string buffer;
+ bool connected;
+ void Debug(int from);
};
#endif