7 #ifndef IRCBOT_CONNECTION_CONNECTION_H_ 8 #define IRCBOT_CONNECTION_CONNECTION_H_ 11 typedef unsigned int UINT_PTR;
12 typedef UINT_PTR SOCKET;
15 #define INVALID_SOCKET ((SOCKET)(~0)) 16 #define SOCKET_ERROR (-1) 86 #endif // IRCBOT_CONNECTION_CONNECTION_H_ char port[8]
Port to be used.
Definition: connection.h:44
char address[32]
Address of the server.
Definition: connection.h:39
struct addrinfo * ai_result
Addrinfo result pointer.
Definition: connection.h:32
IRC_Connection * connection_create(const char address[], const char port[])
"Constructor" for IRC_Connection.
Definition: connection.c:93
SOCKET socket
Socket handle.
Definition: connection.h:25
int connection_send(IRC_Connection *connection, const char msg[])
Send data (char) to remote server.
Definition: connection.c:160
int connection_read(IRC_Connection *connection)
Receive data from remote server.
Definition: connection.c:183
int recvbuflen
Length of recvbuf, by default = 512.
Definition: connection.h:48
IRC_Connection struct holds the socket handle, receiving buffer and basic info about the connection...
Definition: connection.h:23
struct addrinfo * ai_hints
Definition: connection.h:34
char * recvbuf
Buffer used by recv() to store incoming data.
Definition: connection.h:46
int connection_disconnect(IRC_Connection *connection)
Disconnect from remote server and close the socket.
Definition: connection.c:150
struct IRC_Connection IRC_Connection
IRC_Connection struct holds the socket handle, receiving buffer and basic info about the connection...
int connection_connect(IRC_Connection *connection)
Actually connect to the remote server specified in connection_create().
Definition: connection.c:118