]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/arm-ds5-gator.git/blobdiff - daemon/OlySocket.h
gator: Version 5.18
[android-sdk/arm-ds5-gator.git] / daemon / OlySocket.h
index 5bab7d1f4cc46f4152443cae99254b012629ec51..eab786b304bf3907cfe361623751d8c7018126a9 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) ARM Limited 2010-2013. All rights reserved.
+ * Copyright (C) ARM Limited 2010-2014. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -9,27 +9,44 @@
 #ifndef __OLY_SOCKET_H__
 #define __OLY_SOCKET_H__
 
-#include <string.h>
-
 class OlySocket {
 public:
-  OlySocket(int port, bool multipleConnections = false);
-  OlySocket(int port, char* hostname);
+  OlySocket(int port, const char* hostname);
+  OlySocket(int socketID);
+#ifndef WIN32
+  OlySocket(const char* path);
+#endif
   ~OlySocket();
-  int acceptConnection();
+
   void closeSocket();
-  void closeServerSocket();
   void shutdownConnection();
-  void send(char* buffer, int size);
-  void sendString(const char* string) {send((char*)string, strlen(string));}
+  void send(const char* buffer, int size);
   int receive(char* buffer, int size);
   int receiveNBytes(char* buffer, int size);
   int receiveString(char* buffer, int size);
-  int getSocketID() {return mSocketID;}
+
+  bool isValid() const { return mSocketID >= 0; }
+
+private:
+  int mSocketID;
+
+  void createClientSocket(const char* hostname, int port);
+};
+
+class OlyServerSocket {
+public:
+  OlyServerSocket(int port);
+#ifndef WIN32
+  OlyServerSocket(const char* path);
+#endif
+  ~OlyServerSocket();
+
+  int acceptConnection();
+  void closeServerSocket();
+
 private:
-  int mSocketID, mFDServer;
-  void createClientSocket(char* hostname, int port);
-  void createSingleServerConnection(int port);
+  int mFDServer;
+
   void createServerSocket(int port);
 };