#include <tcp_socket.h>
Definition at line 13 of file tcp_socket.h.
 
◆ CTCPSocket()
      
        
          | argos::CTCPSocket::CTCPSocket  | 
          ( | 
          int  | 
          n_stream = -1 | ) | 
           | 
        
      
 
 
◆ ~CTCPSocket()
      
        
          | argos::CTCPSocket::~CTCPSocket  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ Accept()
      
        
          | void argos::CTCPSocket::Accept  | 
          ( | 
          CTCPSocket &  | 
          c_socket | ) | 
           | 
        
      
 
Accept a connection from a client. 
Internally, the connection is forced to be only IPv4. Before calling this function, you must first call Listen() to setup connection listening. 
- Parameters
 - 
  
    | c_socket | The socket on which the connection has been created  | 
  
   
- Exceptions
 - 
  
  
 
- See also
 - Listen 
 
- 
Connect 
 
Definition at line 127 of file tcp_socket.cpp.
 
 
◆ Connect()
      
        
          | void argos::CTCPSocket::Connect  | 
          ( | 
          const std::string &  | 
          str_hostname,  | 
        
        
           | 
           | 
          SInt32  | 
          n_port  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Connects this socket to the specified hostname and port. 
Internally, the connection is forced to be only IPv4. 
- Parameters
 - 
  
    | str_hostname | The wanted hostname  | 
    | n_port | The wanted port  | 
  
   
- Exceptions
 - 
  
  
 
- See also
 - Accept 
 
Definition at line 32 of file tcp_socket.cpp.
 
 
◆ Disconnect()
      
        
          | void argos::CTCPSocket::Disconnect  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ GetAddress()
  
  
      
        
          | const std::string& argos::CTCPSocket::GetAddress  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Returns a string containing the IPv4 address in dot notation. 
- Returns
 - A string containing the IPv4 address in dot notation. 
 
Definition at line 41 of file tcp_socket.h.
 
 
◆ GetStream()
  
  
      
        
          | int argos::CTCPSocket::GetStream  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Returns the socket stream. 
- Returns
 - the socket stream. 
 
Definition at line 33 of file tcp_socket.h.
 
 
◆ IsConnected()
  
  
      
        
          | bool argos::CTCPSocket::IsConnected  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Returns true if the socket is connected. 
- Returns
 true if the socket is connected. 
Definition at line 25 of file tcp_socket.h.
 
 
◆ Listen()
      
        
          | void argos::CTCPSocket::Listen  | 
          ( | 
          SInt32  | 
          n_port,  | 
        
        
           | 
           | 
          SInt32  | 
          n_queue_length = 10  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Listens for connections on the specified local port. 
Internally, the connection is forced to be only IPv4. To actually accept connections, you must call Accept() after calling this function. 
- Parameters
 - 
  
    | n_port | The wanted port  | 
    | n_queue_length | The maximum length of the queue of pending connections (also called the backlog)  | 
  
   
- Exceptions
 - 
  
  
 
- See also
 - Accept 
 
Definition at line 72 of file tcp_socket.cpp.
 
 
◆ ReceiveBuffer()
      
        
          | bool argos::CTCPSocket::ReceiveBuffer  | 
          ( | 
          UInt8 *  | 
          pun_buffer,  | 
        
        
           | 
           | 
          size_t  | 
          un_size  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Fills the passed buffer with the data received through the socket. 
- Parameters
 - 
  
    | pun_buffer | The buffer to fill  | 
    | un_size | The size of the buffer  | 
  
   
- Returns
 true if the buffer was filled correctly; false if the connection was closed by the other peer 
- Exceptions
 - 
  
  
 
Definition at line 169 of file tcp_socket.cpp.
 
 
◆ ReceiveByteArray()
      
        
          | bool argos::CTCPSocket::ReceiveByteArray  | 
          ( | 
          CByteArray &  | 
          c_byte_array | ) | 
           | 
        
      
 
Receives the passed byte array through the socket. 
Internally, this function first receives the size of the byte array as a long int, and then receives the content of the byte array. It is meant to the be used in conjunction with SendByteArray(). 
- Parameters
 - 
  
    | c_byte_array | The byte array  | 
  
   
- Returns
 true if the buffer was filled correctly; false if the connection was closed by the other peer 
- Exceptions
 - 
  
  
 
- See also
 - CByteArray 
 
- 
ReceiveBuffer 
 
- 
SendByteArray 
 
Definition at line 199 of file tcp_socket.cpp.
 
 
◆ SendBuffer()
      
        
          | void argos::CTCPSocket::SendBuffer  | 
          ( | 
          const UInt8 *  | 
          pun_buffer,  | 
        
        
           | 
           | 
          size_t  | 
          un_size  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Sends the passed buffer through the socket. 
- Parameters
 - 
  
    | pun_buffer | The wanted buffer  | 
    | un_size | The size of the buffer  | 
  
   
- Exceptions
 - 
  
  
 
Definition at line 152 of file tcp_socket.cpp.
 
 
◆ SendByteArray()
      
        
          | void argos::CTCPSocket::SendByteArray  | 
          ( | 
          const CByteArray &  | 
          c_byte_array | ) | 
           | 
        
      
 
Sends the passed byte array through the socket. 
Internally, this function first sends the size of the byte array as a long int, and then sends the content of the byte array. It is meant to the be used in conjunction with ReceiveByteArray(). 
- Parameters
 - 
  
    | c_byte_array | The byte array  | 
  
   
- Exceptions
 - 
  
  
 
- See also
 - CByteArray 
 
- 
SendBuffer 
 
- 
ReceiveByteArray 
 
Definition at line 188 of file tcp_socket.cpp.