]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/arm-ds5-gator.git/blob - daemon/OlySocket.h
gator-daemon: Fix sequence-point compile error
[android-sdk/arm-ds5-gator.git] / daemon / OlySocket.h
1 /**
2  * Copyright (C) ARM Limited 2010-2012. All rights reserved.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  */
9 #ifndef __OLY_SOCKET_H__
10 #define __OLY_SOCKET_H__
12 #include <string.h>
14 class OlySocket {
15 public:
16         OlySocket(int port, bool multipleConnections = false);
17         OlySocket(int port, char* hostname);
18         ~OlySocket();
19         int acceptConnection();
20         void closeSocket();
21         void closeServerSocket();
22         void shutdownConnection();
23         void send(char* buffer, int size);
24         void sendString(const char* string) {send((char*)string, strlen(string));}
25         int receive(char* buffer, int size);
26         int receiveNBytes(char* buffer, int size);
27         int receiveString(char* buffer, int size);
28         int getSocketID() {return mSocketID;}
29 private:
30         int mSocketID, mFDServer;
31         void createClientSocket(char* hostname, int port);
32         void createSingleServerConnection(int port);
33         void createServerSocket(int port);
34 };
36 #endif  //__OLY_SOCKET_H__