|
PLearn 0.1
|
#include <IPopen.h>

Public Member Functions | |
| IPServer (int port_no, int max_connections) | |
| IPServer (int max_connections_) | |
| IPServer () | |
| ~IPServer () | |
| int | get_socket_fd () |
| struct sockaddr_in * | get_address () |
| string | machine_name () |
| int | port_no () |
Static Public Member Functions | |
| static void | set_ip_port (int port_no, int max_connections_=100) |
Static Public Attributes | |
| static int | ip_port = 15000 |
| static int | max_connections = 100 |
Protected Attributes | |
| int | socket_fd |
| int | port |
| struct sockaddr_in | address |
Private Member Functions | |
| void | DelayedConstructor (int port_no, int max_connections_) |
Definition at line 64 of file IPopen.h.
{
DelayedConstructor(port_no, max_connections);
};
| PLearn::IPServer::IPServer | ( | int | max_connections_ | ) | [inline] |
Definition at line 67 of file IPopen.h.
{
DelayedConstructor(ip_port, max_connections_);
};
| PLearn::IPServer::IPServer | ( | ) | [inline] |
Definition at line 70 of file IPopen.h.
{
DelayedConstructor(ip_port, max_connections);
};
| PLearn::IPServer::~IPServer | ( | ) | [inline] |
Definition at line 88 of file IPopen.h.
References PLERROR.
{
port = port_no;
int addr_len = sizeof(struct sockaddr_in);
socket_fd = socket(AF_INET, SOCK_STREAM, 0);
if (socket_fd <= 0)
PLERROR("Cannot create socket");
address.sin_family = AF_INET;
address.sin_addr.s_addr = INADDR_ANY;
address.sin_port = htons(port_no);
if (bind(socket_fd, (struct sockaddr *)&address, addr_len))
PLERROR("Cannot bind socket"); // ... and in the darknest bind them
listen(socket_fd, max_connections);
int nodelay = 1;
setsockopt(socket_fd, IPPROTO_TCP, TCP_NODELAY, (char *)nodelay, sizeof(int));
}
| struct sockaddr_in* PLearn::IPServer::get_address | ( | ) | [inline, read] |
Definition at line 79 of file IPopen.h.
Referenced by PLearn::IPopen::establish_communication().
{ return &address; };

| int PLearn::IPServer::get_socket_fd | ( | ) | [inline] |
Definition at line 78 of file IPopen.h.
Referenced by PLearn::IPopen::establish_communication().
{ return socket_fd; };

| string PLearn::IPServer::machine_name | ( | ) | [inline] |
Definition at line 80 of file IPopen.h.
References PLearn::hostname().
{ return hostname(); };

| int PLearn::IPServer::port_no | ( | ) | [inline] |
| static void PLearn::IPServer::set_ip_port | ( | int | port_no, |
| int | max_connections_ = 100 |
||
| ) | [inline, static] |
Definition at line 109 of file IPopen.h.
References ip_port, and max_connections.
{ IPServer::ip_port = port_no; IPServer::max_connections = max_connections_; };
struct sockaddr_in PLearn::IPServer::address [protected] |
int PLearn::IPServer::ip_port = 15000 [static] |
Definition at line 107 of file IPopen.h.
Referenced by set_ip_port().
int PLearn::IPServer::max_connections = 100 [static] |
Definition at line 108 of file IPopen.h.
Referenced by set_ip_port().
int PLearn::IPServer::port [protected] |
int PLearn::IPServer::socket_fd [protected] |
1.7.4