Skip to content

Commit

Permalink
libraries: libcore[socket] g
Browse files Browse the repository at this point in the history
  • Loading branch information
krishpranav committed Oct 1, 2023
1 parent 890cb8e commit e9354d6
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions libraries/libcore/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,42 @@ namespace Core
class Socket : public IODevice
{
public:
enum class Type
{
Invalid,
TCP,
UDP,
Local,
}; // enum class Type

/// @brief Destroy the Socket object
virtual ~Socket() override;

Type type() const
{
return m_type;
}

/**
* @param hostname
* @param port
* @return true
* @return false
*/
virtual bool connect(const String& hostname, int port);

/**
* @param port
* @return true
* @return false
*/
bool connect(const SocketAddress&, int port);

/**
* @param max_size
* @return ByteBuffer
*/
ByteBuffer receive(int max_size);

protected:
Socket(Type, Object* parent);
Expand Down

0 comments on commit e9354d6

Please sign in to comment.