tcp.h 488 Bytes
#ifndef TCP_H
#define TCP_H

#define MAX_TCP 65535

#include <iostream>

#include <string.h>
#include <cstdlib>

#include <errno.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <netdb.h>
#include <fcntl.h>

#ifdef __FreeBSD__
#include <netinet/in.h>
#endif

using namespace std;

int createSocket();
void connect(int s, uint16_t port, char *hostname, int timeout);
int sendMsg(int s, const char *msg, size_t msgLength);
int recvMsg(int s, char *msg, size_t msgLength);

#endif