Implementation of connection.h. More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/socket.h>
#include <unistd.h>
#include "connection.h"
Macros | |
#define | ERROR 0 |
#define | OK 1 |
Functions | |
IRC_Connection * | connection_create (const char address[], const char port[]) |
"Constructor" for IRC_Connection. More... | |
int | connection_connect (IRC_Connection *connection) |
Actually connect to the remote server specified in connection_create() . More... | |
int | connection_disconnect (IRC_Connection *connection) |
Disconnect from remote server and close the socket. More... | |
int | connection_send (IRC_Connection *connection, const char msg[]) |
Send data (char) to remote server. More... | |
int | connection_read (IRC_Connection *connection) |
Receive data from remote server. More... | |
Implementation of connection.h.
int connection_connect | ( | IRC_Connection * | connection | ) |
Actually connect to the remote server specified in connection_create()
.
connection | a pointer to IRC_Connection object |
IRC_Connection* connection_create | ( | const char | address[], |
const char | port[] | ||
) |
"Constructor" for IRC_Connection.
The preferred way to create new connections.
address | a string with the server's URI |
port | a string with the port to be used |
int connection_disconnect | ( | IRC_Connection * | connection | ) |
Disconnect from remote server and close the socket.
connection | a pointer to IRC_Connection object |
int connection_read | ( | IRC_Connection * | connection | ) |
Receive data from remote server.
connection | a pointer to IRC_Connection object |
int connection_send | ( | IRC_Connection * | connection, |
const char | msg[] | ||
) |
Send data (char) to remote server.
connection | a pointer to IRC_Connection object |
msg | data to be sent |