15976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org/* 25976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * libjingle 35976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * Copyright 2004--2005, Google Inc. 45976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * 55976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * Redistribution and use in source and binary forms, with or without 65976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * modification, are permitted provided that the following conditions are met: 75976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * 85976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * 1. Redistributions of source code must retain the above copyright notice, 95976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * this list of conditions and the following disclaimer. 105976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * 2. Redistributions in binary form must reproduce the above copyright notice, 115976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * this list of conditions and the following disclaimer in the documentation 125976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * and/or other materials provided with the distribution. 135976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * 3. The name of the author may not be used to endorse or promote products 145976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * derived from this software without specific prior written permission. 155976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * 165976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 175976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 185976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 195976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 205976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 215976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 225976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 235976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 245976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 255976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 265976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org */ 275976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org 285976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#ifndef TALK_BASE_SOCKET_H__ 295976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define TALK_BASE_SOCKET_H__ 305976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org 315976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#include <errno.h> 325976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org 335976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#ifdef POSIX 345976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#include <sys/types.h> 355976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#include <sys/socket.h> 365976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#include <arpa/inet.h> 375976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#include <netinet/in.h> 385976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define SOCKET_EACCES EACCES 395976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#endif 405976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org 415976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#ifdef WIN32 425976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#include "talk/base/win32.h" 435976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#endif 445976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org 455976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#include "talk/base/basictypes.h" 465976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#include "talk/base/socketaddress.h" 475976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org 485976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// Rather than converting errors into a private namespace, 495976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// Reuse the POSIX socket api errors. Note this depends on 505976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// Win32 compatibility. 515976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org 525976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#ifdef WIN32 535976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef EWOULDBLOCK // Remove errno.h's definition for each macro below. 545976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define EWOULDBLOCK WSAEWOULDBLOCK 555976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef EINPROGRESS 565976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define EINPROGRESS WSAEINPROGRESS 575976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef EALREADY 585976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define EALREADY WSAEALREADY 595976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef ENOTSOCK 605976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define ENOTSOCK WSAENOTSOCK 615976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef EDESTADDRREQ 625976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define EDESTADDRREQ WSAEDESTADDRREQ 635976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef EMSGSIZE 645976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define EMSGSIZE WSAEMSGSIZE 655976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef EPROTOTYPE 665976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define EPROTOTYPE WSAEPROTOTYPE 675976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef ENOPROTOOPT 685976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define ENOPROTOOPT WSAENOPROTOOPT 695976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef EPROTONOSUPPORT 705976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define EPROTONOSUPPORT WSAEPROTONOSUPPORT 715976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef ESOCKTNOSUPPORT 725976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT 735976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef EOPNOTSUPP 745976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define EOPNOTSUPP WSAEOPNOTSUPP 755976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef EPFNOSUPPORT 765976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define EPFNOSUPPORT WSAEPFNOSUPPORT 775976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef EAFNOSUPPORT 785976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define EAFNOSUPPORT WSAEAFNOSUPPORT 795976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef EADDRINUSE 805976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define EADDRINUSE WSAEADDRINUSE 815976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef EADDRNOTAVAIL 825976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define EADDRNOTAVAIL WSAEADDRNOTAVAIL 835976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef ENETDOWN 845976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define ENETDOWN WSAENETDOWN 855976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef ENETUNREACH 865976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define ENETUNREACH WSAENETUNREACH 875976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef ENETRESET 885976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define ENETRESET WSAENETRESET 895976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef ECONNABORTED 905976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define ECONNABORTED WSAECONNABORTED 915976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef ECONNRESET 925976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define ECONNRESET WSAECONNRESET 935976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef ENOBUFS 945976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define ENOBUFS WSAENOBUFS 955976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef EISCONN 965976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define EISCONN WSAEISCONN 975976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef ENOTCONN 985976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define ENOTCONN WSAENOTCONN 995976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef ESHUTDOWN 1005976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define ESHUTDOWN WSAESHUTDOWN 1015976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef ETOOMANYREFS 1025976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define ETOOMANYREFS WSAETOOMANYREFS 1035976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef ETIMEDOUT 1045976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define ETIMEDOUT WSAETIMEDOUT 1055976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef ECONNREFUSED 1065976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define ECONNREFUSED WSAECONNREFUSED 1075976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef ELOOP 1085976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define ELOOP WSAELOOP 1095976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef ENAMETOOLONG 1105976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define ENAMETOOLONG WSAENAMETOOLONG 1115976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef EHOSTDOWN 1125976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define EHOSTDOWN WSAEHOSTDOWN 1135976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef EHOSTUNREACH 1145976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define EHOSTUNREACH WSAEHOSTUNREACH 1155976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef ENOTEMPTY 1165976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define ENOTEMPTY WSAENOTEMPTY 1175976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef EPROCLIM 1185976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define EPROCLIM WSAEPROCLIM 1195976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef EUSERS 1205976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define EUSERS WSAEUSERS 1215976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef EDQUOT 1225976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define EDQUOT WSAEDQUOT 1235976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef ESTALE 1245976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define ESTALE WSAESTALE 1255976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef EREMOTE 1265976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define EREMOTE WSAEREMOTE 1275976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#undef EACCES 1285976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define SOCKET_EACCES WSAEACCES 1295976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#endif // WIN32 1305976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org 1315976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#ifdef POSIX 1325976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define INVALID_SOCKET (-1) 1335976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define SOCKET_ERROR (-1) 1345976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define closesocket(s) close(s) 1355976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#endif // POSIX 1365976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org 1375976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.orgnamespace talk_base { 1385976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org 1395976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.orginline bool IsBlockingError(int e) { 1405976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org return (e == EWOULDBLOCK) || (e == EAGAIN) || (e == EINPROGRESS); 1415976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org} 1425976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org 1435976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// General interface for the socket implementations of various networks. The 1445976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// methods match those of normal UNIX sockets very closely. 1455976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.orgclass Socket { 1465976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org public: 1475976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org virtual ~Socket() {} 1485976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org 1495976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org // Returns the address to which the socket is bound. If the socket is not 1505976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org // bound, then the any-address is returned. 1515976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org virtual SocketAddress GetLocalAddress() const = 0; 1525976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org 1535976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org // Returns the address to which the socket is connected. If the socket is 1545976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org // not connected, then the any-address is returned. 1555976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org virtual SocketAddress GetRemoteAddress() const = 0; 1565976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org 1575976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org virtual int Bind(const SocketAddress& addr) = 0; 1585976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org virtual int Connect(const SocketAddress& addr) = 0; 1595976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org virtual int Send(const void *pv, size_t cb) = 0; 1605976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org virtual int SendTo(const void *pv, size_t cb, const SocketAddress& addr) = 0; 1615976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org virtual int Recv(void *pv, size_t cb) = 0; 1625976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org virtual int RecvFrom(void *pv, size_t cb, SocketAddress *paddr) = 0; 1635976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org virtual int Listen(int backlog) = 0; 1645976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org virtual Socket *Accept(SocketAddress *paddr) = 0; 1655976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org virtual int Close() = 0; 1665976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org virtual int GetError() const = 0; 1675976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org virtual void SetError(int error) = 0; 1685976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org inline bool IsBlocking() const { return IsBlockingError(GetError()); } 1695976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org 1705976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org enum ConnState { 1715976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org CS_CLOSED, 1725976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org CS_CONNECTING, 1735976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org CS_CONNECTED 1745976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org }; 1755976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org virtual ConnState GetState() const = 0; 1765976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org 1775976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org // Fills in the given uint16 with the current estimate of the MTU along the 1785976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org // path to the address to which this socket is connected. NOTE: This method 1795976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org // can block for up to 10 seconds on Windows. 1805976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org virtual int EstimateMTU(uint16* mtu) = 0; 1815976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org 1825976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org enum Option { 1835976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org OPT_DONTFRAGMENT, 1845976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org OPT_RCVBUF, // receive buffer size 1855976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org OPT_SNDBUF, // send buffer size 1865976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org OPT_NODELAY, // whether Nagle algorithm is enabled 1875976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org OPT_IPV6_V6ONLY // Whether the socket is IPv6 only. 1885976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org }; 1895976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org virtual int GetOption(Option opt, int* value) = 0; 1905976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org virtual int SetOption(Option opt, int value) = 0; 1915976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org 1925976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org protected: 1935976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org Socket() {} 1945976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org 1955976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org private: 1965976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org DISALLOW_EVIL_CONSTRUCTORS(Socket); 1975976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org}; 1985976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org 1995976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org} // namespace talk_base 2005976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org 2015976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#endif // TALK_BASE_SOCKET_H__ 202