214853702f
* Fixed completely broken error reporting; Write()/Read() will now return the proper error code (and ssize_t instead of int32). * Reimplemented WaitForData() using poll() which is more efficient. * Now uses BNetworkAddress to resolve the server address which also should now work with IPv6. * Removed some unused headers. * Minor coding style cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43141 a95241bf-73f2-0310-859d-f6bbb57e9c96
49 lines
876 B
C++
49 lines
876 B
C++
/*
|
|
* Copyright 2010-2011, Haiku Inc. All Rights Reserved.
|
|
* Copyright 2010 Clemens Zeidler. All rights reserved.
|
|
*
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef SERVER_CONNECTION_H
|
|
#define SERVER_CONNECTION_H
|
|
|
|
|
|
#include "SupportDefs.h"
|
|
|
|
|
|
namespace BPrivate {
|
|
|
|
|
|
class AbstractConnection;
|
|
|
|
|
|
class ServerConnection {
|
|
public:
|
|
ServerConnection();
|
|
~ServerConnection();
|
|
|
|
status_t ConnectSSL(const char* server,
|
|
uint32 port = 993);
|
|
|
|
status_t ConnectSocket(const char* server,
|
|
uint32 port = 143);
|
|
status_t Disconnect();
|
|
|
|
status_t WaitForData(bigtime_t timeout);
|
|
|
|
ssize_t Read(char* buffer, uint32 length);
|
|
ssize_t Write(const char* buffer, uint32 length);
|
|
|
|
private:
|
|
AbstractConnection* fConnection;
|
|
};
|
|
|
|
|
|
} // namespace BPrivate
|
|
|
|
|
|
using BPrivate::ServerConnection;
|
|
|
|
|
|
#endif // SERVER_CONNECTION_H
|