#include <basic_socket.h>
rcsc::BasicSocketに対する継承グラフ
Public 型 | |
enum | SocketType { DATAGRAM_TYPE, STREAM_TYPE } |
Public メソッド | |
virtual | ~BasicSocket () |
destructor. close socket automatically | |
int | fd () const |
returns socket file descriptor | |
bool | isOpen () const |
check if socket is opened or not. | |
int | close () |
close socket | |
virtual int | send (const char *data, const std::size_t len)=0 |
send stream data to the connected host. | |
virtual int | receive (char *buf, const std::size_t len)=0 |
receive stream data from the connected remote host. | |
Protected メソッド | |
BasicSocket () | |
constructor for server socket | |
void | setDestPort (const void *addr) |
set distination port | |
bool | open (const SocketType type) |
open socket | |
bool | bind (const int port=0) |
bind the socket to local address | |
bool | setAddr (const char *hostname, const int port) |
set the address info of the specified remote host. | |
int | setNonBlocking () |
set non blocking mode. | |
int | connectToPresetAddr () |
connect to address set by setAddr() | |
int | writeToStream (const char *data, const std::size_t len) |
send stream data to the connected host. | |
int | readFromStream (char *buf, const std::size_t len) |
receive stream data from the connected remote host. | |
int | sendDatagramPacket (const char *data, const std::size_t len) |
send datagram data to the connected host. | |
int | receiveDatagramPacket (char *buf, const std::size_t len, const bool overwrite_dist_addr=false) |
receive datagram data from the connected remote host. | |
Protected 変数 | |
boost::scoped_ptr< AddrImpl > | M_dest |
destination address |
rcsc::BasicSocket::BasicSocket | ( | ) | [protected] |
constructor for server socket
port | port number to receive packet. |
void rcsc::BasicSocket::setDestPort | ( | const void * | addr | ) | [protected] |
set distination port
addr | address implementation dependent address |
bool rcsc::BasicSocket::open | ( | const SocketType | type | ) | [protected] |
open socket
bool rcsc::BasicSocket::bind | ( | const int | port = 0 |
) | [protected] |
bind the socket to local address
port | port number to be binded. |
bool rcsc::BasicSocket::setAddr | ( | const char * | hostname, | |
const int | port | |||
) | [protected] |
set the address info of the specified remote host.
hostname | the name of remote host.(or IP address) | |
port | port number of remote host. |
int rcsc::BasicSocket::setNonBlocking | ( | ) | [protected] |
set non blocking mode.
int rcsc::BasicSocket::connectToPresetAddr | ( | ) | [protected] |
int rcsc::BasicSocket::writeToStream | ( | const char * | data, | |
const std::size_t | len | |||
) | [protected] |
send stream data to the connected host.
data | the pointer to the data to be sent. | |
len | the length of data. |
int rcsc::BasicSocket::readFromStream | ( | char * | buf, | |
const std::size_t | len | |||
) | [protected] |
receive stream data from the connected remote host.
buf | buffer to receive data | |
len | maximam length of receive buffer |
0 | error occured and errno is EWOULDBLOCK | |
-1 | error occured |
int rcsc::BasicSocket::sendDatagramPacket | ( | const char * | data, | |
const std::size_t | len | |||
) | [protected] |
send datagram data to the connected host.
msg | the pointer to the data to be sent. | |
len | the length of data. |
int rcsc::BasicSocket::receiveDatagramPacket | ( | char * | buf, | |
const std::size_t | len, | |||
const bool | overwrite_dist_addr = false | |||
) | [protected] |
receive datagram data from the connected remote host.
buf | buffer to receive data | |
len | maximal length of buffer buf | |
overwrite_dist_addr | if this value is true, set distination address to sender address of this packet. |
0 | error occured and errno is EWOULDBLOCK | |
-1 | error occured |
bool rcsc::BasicSocket::isOpen | ( | ) | const [inline] |
check if socket is opened or not.
int rcsc::BasicSocket::close | ( | ) |
close socket
virtual int rcsc::BasicSocket::send | ( | const char * | data, | |
const std::size_t | len | |||
) | [pure virtual] |
send stream data to the connected host.
data | the pointer to the data to be sent. | |
len | the length of data. |
rcsc::TCPSocket・rcsc::UDPSocketで実装されています。
virtual int rcsc::BasicSocket::receive | ( | char * | buf, | |
const std::size_t | len | |||
) | [pure virtual] |
receive stream data from the connected remote host.
buf | buffer to receive data | |
len | maximal length of buffer buf |
0 | error occured and errno is EWOULDBLOCK | |
-1 | error occured |
rcsc::TCPSocket・rcsc::UDPSocketで実装されています。