Proud::CSocket Class Referenceabstract

Public Member Functions

virtual bool Bind ()=0
 
virtual bool Bind (int port)=0
 
virtual bool Bind (const PNTCHAR *addr, int port)=0
 
virtual SocketErrorCode Connect (String hostAddr, int hostPort)=0
 
virtual SocketErrorCode IssueRecvFrom (int length)=0
 
virtual SocketErrorCode IssueSendTo (uint8_t *data, int count, AddrPort sendTo)=0
 
virtual SocketErrorCode IssueRecv (int length)=0
 
virtual SocketErrorCode IssueSend (uint8_t *data, int count)=0
 
virtual bool GetRecvOverlappedResult (bool waitUntilComplete, OverlappedResult &ret)=0
 
virtual bool GetSendOverlappedResult (bool waitUntilComplete, OverlappedResult &ret)=0
 
virtual AddrPort GetSockName ()=0
 
virtual AddrPort GetPeerName ()=0
 
virtual void SetBlockingMode (bool isBlockingMode)=0
 
virtual uint8_t * GetRecvBufferPtr ()=0
 

Static Public Member Functions

static String GetIPAddress (String hostName)
 
static CSocketNew (SocketType type, ISocketDelegate *dg)
 

Detailed Description

CSocket class

  • It is useful when you access external Server or http without NetClient of ProudNet.
  • Use Proud::FastSocket internally

Member Function Documentation

virtual SocketErrorCode Proud::CSocket::Connect ( String  hostAddr,
int  hostPort 
)
pure virtual

Connect.

Parameters
hostAddrAddress of host
hostPortPort of host
static String Proud::CSocket::GetIPAddress ( String  hostName)
static

TODO:translate needed.

virtual AddrPort Proud::CSocket::GetPeerName ( )
pure virtual

TODO:translate needed. Get the socket address to the peer.

virtual uint8_t* Proud::CSocket::GetRecvBufferPtr ( )
pure virtual

TODO:translate needed. Get the pointer of the recv buffer.

virtual bool Proud::CSocket::GetRecvOverlappedResult ( bool  waitUntilComplete,
OverlappedResult ret 
)
pure virtual

TODO:translate needed. Wait for the result of async issue.

  • If nothing has been completed, return null.
  • If completion success or failures as socket errors, etc. occur, return the object but it is filled with m_errorCode.
    Parameters
    waitUntilCompleteDetermine whether to wait until complete.
    Referto the result OverlappedResult
    Returns
    Return true if successful or false if failed.
virtual bool Proud::CSocket::GetSendOverlappedResult ( bool  waitUntilComplete,
OverlappedResult ret 
)
pure virtual

TODO:translate needed. Wait for the result of async issue.

  • If nothing has been completed, return null.
  • If completion success or failures as socket errors, etc. occur, return the object but it is filled with m_errorCode.
    Parameters
    waitUntilCompleteDetermine whether to wait until complete.
    retRefer to the result OverlappedResult
    Returns
    Return true if successful or false if failed.
virtual AddrPort Proud::CSocket::GetSockName ( )
pure virtual

TODO:translate needed. Get the address of the socket

virtual SocketErrorCode Proud::CSocket::IssueRecv ( int  length)
pure virtual

TODO:translate needed. TCP socket

  • Issue Recv
    Parameters
    lengthSize of length buffer
    Returns
    Return the socket error. If SocketErrorCode_Ok, it is normal.
virtual SocketErrorCode Proud::CSocket::IssueRecvFrom ( int  length)
pure virtual

UDP socket

  • Issue Recv
    Parameters
    lengthSize of length buffer
    Returns
    Return the socket error. If SocketErrorCode_Ok, it is normal.
virtual SocketErrorCode Proud::CSocket::IssueSend ( uint8_t *  data,
int  count 
)
pure virtual

TODO:translate needed. TCP socket

  • Issue Send.
    Parameters
    dataArray of the data to be sent.
    countSize of the array
    Returns
    Return the socket error. If SocketErrorCode_Ok, it is normal.
virtual SocketErrorCode Proud::CSocket::IssueSendTo ( uint8_t *  data,
int  count,
AddrPort  sendTo 
)
pure virtual

UDP socket

  • Does asynchronous send call.
static CSocket* Proud::CSocket::New ( SocketType  type,
ISocketDelegate dg 
)
static

TODO:translate needed. Generate CSocket object

Parameters
typeDetermine the type of the socket.
dgObject to receive the socket event. Refer to ISocketDelegate.
virtual void Proud::CSocket::SetBlockingMode ( bool  isBlockingMode)
pure virtual

TODO:translate needed. Select whether to use the blocking mode for the communication.