projects
/
silc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
A LOT updates. Cannot separate. :)
[silc.git]
/
lib
/
silcutil
/
silcnet.c
diff --git
a/lib/silcutil/silcnet.c
b/lib/silcutil/silcnet.c
index 68a820f6316ec79b5fdb6dc95dc31a817f849b5f..c4d6d9d7a653a5f00575a4cefcc0daa9541b61f3 100644
(file)
--- a/
lib/silcutil/silcnet.c
+++ b/
lib/silcutil/silcnet.c
@@
-20,6
+20,9
@@
/*
* $Id$
* $Log$
/*
* $Id$
* $Log$
+ * Revision 1.2 2000/10/31 19:48:32 priikone
+ * A LOT updates. Cannot separate. :)
+ *
* Revision 1.1 2000/09/13 17:45:16 priikone
* Splitted SILC core library. Core library includes now only
* SILC protocol specific stuff. New utility library includes the
* Revision 1.1 2000/09/13 17:45:16 priikone
* Splitted SILC core library. Core library includes now only
* SILC protocol specific stuff. New utility library includes the
@@
-149,8
+152,9
@@
int silc_net_create_connection(int port, char *host)
return -1;
}
return -1;
}
- /* Set appropriate option */
+ /* Set appropriate option
s
*/
silc_net_set_socket_opt(sock, IPPROTO_TCP, TCP_NODELAY, 1);
silc_net_set_socket_opt(sock, IPPROTO_TCP, TCP_NODELAY, 1);
+ silc_net_set_socket_opt(sock, SOL_SOCKET, SO_KEEPALIVE, 1);
SILC_LOG_DEBUG(("Connection created"));
SILC_LOG_DEBUG(("Connection created"));
@@
-205,8
+209,9
@@
int silc_net_create_connection_async(int port, char *host)
}
}
}
}
- /* Set appropriate option */
+ /* Set appropriate option
s
*/
silc_net_set_socket_opt(sock, IPPROTO_TCP, TCP_NODELAY, 1);
silc_net_set_socket_opt(sock, IPPROTO_TCP, TCP_NODELAY, 1);
+ silc_net_set_socket_opt(sock, SOL_SOCKET, SO_KEEPALIVE, 1);
SILC_LOG_DEBUG(("Connection operation in progress"));
SILC_LOG_DEBUG(("Connection operation in progress"));
@@
-304,3
+309,13
@@
void silc_net_check_host_by_sock(int sock, char **hostname, char **ip)
memcpy(*ip, host_ip, strlen(host_ip));
SILC_LOG_DEBUG(("Resolved IP address `%s'", *ip));
}
memcpy(*ip, host_ip, strlen(host_ip));
SILC_LOG_DEBUG(("Resolved IP address `%s'", *ip));
}
+
+/* Return name of localhost. */
+
+char *silc_net_localhost()
+{
+ char hostname[256];
+ if (!gethostname(hostname, sizeof(hostname)))
+ return strdup(hostname);
+ return NULL;
+}