#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
#include <string.h>
#include <sys/time.h>
#include <arpa/inet.h>
#include <stdio.h>

#define SERV_PORT 2222
#define READBUFSIZE 16384

fd_set watching;

extern void ttyprintf(char *format, ...);
extern int fdset_max(fd_set x);
extern void fdset_copy(fd_set *from, fd_set *to);
extern void process(int socket, int len, char *data);
extern void greet(int fd, struct sockaddr_in *addr);

int make_conn_socket(unsigned short port);
int socket_read(int socket, char **bufaddr);
void disconnect(int socket);
void main_loop(void);
void shut_down(void);
