Twitch SDK (Internal)
standardsocket.h
Go to the documentation of this file.
1 /********************************************************************************************
2 * Twitch Broadcasting SDK
3 *
4 * This software is supplied under the terms of a license agreement with Twitch Interactive, Inc. and
5 * may not be copied or used except in accordance with the terms of that agreement
6 * Copyright (c) 2012-2016 Twitch Interactive, Inc.
7 *********************************************************************************************/
8 
9 #pragma once
10 
11 #include "twitchsdk/core/socket.h"
12 
13 namespace ttv
14 {
15  class StandardSocket;
16  class StandardSocketFactory;
17 }
18 
19 
21 {
22 public:
23  StandardSocket(const std::string& host, uint32_t port);
24  virtual ~StandardSocket();
25 
26  // ISocket Implementation
27  virtual TTV_ErrorCode Connect();
28  virtual TTV_ErrorCode Disconnect();
29  virtual TTV_ErrorCode Send(const uint8_t* buffer, size_t length, size_t& sent);
30  virtual TTV_ErrorCode Recv(uint8_t* buffer, size_t length, size_t& received);
31  virtual uint64_t TotalSent();
32  virtual uint64_t TotalReceived();
33  virtual bool Connected();
34 
35 private:
36  TTV_ErrorCode SetBlockingMode(bool block);
37 
38  std::string mHostName;
39  std::string mPort;
40  int mSocket;
42  uint64_t mTotalSent;
43  uint64_t mTotalRecieved;
44 };
45 
46 
48 {
49 public:
50  virtual ~StandardSocketFactory();
51  virtual bool IsProtocolSupported(const std::string& protocol);
52  virtual TTV_ErrorCode CreateSocket(const std::string& uri, std::shared_ptr<ISocket>& result);
53 };
TTV_ErrorCode SetBlockingMode(bool block)
virtual TTV_ErrorCode Send(const uint8_t *buffer, size_t length, size_t &sent)
TTV_ErrorCode CreateSocket(const std::string &uri, std::shared_ptr< ISocket > &result)
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
Definition: standardsocket.h:47
virtual uint64_t TotalReceived()
uint64_t mTotalSent
Definition: standardsocket.h:42
Definition: standardsocket.h:20
virtual bool Connected()
uint32_t TTV_ErrorCode
Definition: errortypes.h:30
std::string mPort
Definition: standardsocket.h:39
std::string mHostName
Definition: standardsocket.h:38
Definition: socket.h:181
int mLastSocketError
Definition: standardsocket.h:41
Definition: socket.h:405
virtual ~StandardSocket()
virtual TTV_ErrorCode Connect()
StandardSocket(const std::string &host, uint32_t port)
uint64_t mTotalRecieved
Definition: standardsocket.h:43
virtual uint64_t TotalSent()
virtual TTV_ErrorCode Disconnect()
int mSocket
Definition: standardsocket.h:40
virtual TTV_ErrorCode Recv(uint8_t *buffer, size_t length, size_t &received)