*/
#include "sockhelp.h"
+#include "extern.h"
/* Take a service name, and a service type, and return a port number. If
the
/* First try it as aaa.bbb.ccc.ddd. */
saddr.s_addr = inet_addr(address);
- if (saddr.s_addr != -1) {
+ if (saddr.s_addr != 0) {
return &saddr;
}
host = gethostbyname(address);
sock = socket(AF_INET, type, 0);
- printf("Connecting to %s on port %d.\n",inet_ntoa(*addr),htons(port));
+ log("Connecting to %s on port %d.",inet_ntoa(*addr),htons(port));
if (type == SOCK_STREAM) {
connected = connect(sock, (struct sockaddr *) &address,
int sock_gets(int sockfd, char *str, size_t count)
{
int bytes_read;
- int total_count = 0;
+ unsigned int total_count = 0;
char *current_position;
char last_read = 0;