diff --git a/.project b/.project new file mode 100644 index 0000000..b32a019 --- /dev/null +++ b/.project @@ -0,0 +1,11 @@ + + + tuvebot + + + + + + + + diff --git a/socket.c b/socket.c index b4b4352..62cc4cd 100644 --- a/socket.c +++ b/socket.c @@ -26,13 +26,18 @@ perror("socket"); exit(1); } + + return(sConnect(SERVER_HOST,SERVER_PORT); + } + +int sConnect(const char *host,int port) { - hp = gethostbyname(SERVER_HOST); + hp = gethostbyname(host); memcpy(&(rmAddr.sin_addr.s_addr),*(hp->h_addr_list),sizeof(struct in_addr)); - rmAddr.sin_family = AF_INET; // host byte order - rmAddr.sin_port = htons(SERVER_PORT); // short, network byte order + rmAddr.sin_family = AF_INET; // host byte order + rmAddr.sin_port = htons(port); // short, network byte order memset(rmAddr.sin_zero, '\0', sizeof rmAddr.sin_zero); connect(mySocket,&rmAddr,sizeof(rmAddr)); diff --git a/tuvebot.h b/tuvebot.h index d7a37c7..5732ddb 100644 --- a/tuvebot.h +++ b/tuvebot.h @@ -14,13 +14,13 @@ #include -#define SERVER_HOST "www.ubixonline.com" +#define SERVER_HOST "tuved.ubixonline.com" #define SERVER_PORT 9999 #define NUM_THREADS 1 #define MYPORT 9999 // the port users will be connecting to #define BACKLOG 10 // how many pending connections queue will hold -#define LOG_FILE "./tuved.log" +#define LOG_FILE "./tuvebot.log" #define PING_INTERVAL 20 #define MAX_PING 2 #define MAX_COUNT 2 @@ -109,6 +109,7 @@ /* Socket Functions */ int sStartSocket(); +int sConnect(const char *host,int port); ssize_t sReadSocket(void *buffer,size_t length); int sGetConnections(fd_set *readset); int sWriteSocket(char const * __restrict fmt, ...);