From 6cbc09be53e8ee7c35cd3a281360412361ffc6ef Mon Sep 17 00:00:00 2001 From: ilsimo Date: Sun, 25 Mar 2007 21:20:20 +0000 Subject: added ListenAddress configuration option --- sesman/tcp.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'sesman/tcp.c') diff --git a/sesman/tcp.c b/sesman/tcp.c index 36ea4670..e51fbdf9 100644 --- a/sesman/tcp.c +++ b/sesman/tcp.c @@ -21,12 +21,18 @@ * * @file tcp.c * @brief Tcp stream funcions - * @author Jay Sorg - * + * @author Jay Sorg, Simone Fedele + * */ #include "sesman.h" +#include +#include +#include +#include +#include + /*****************************************************************************/ int DEFAULT_CC tcp_force_recv(int sck, char* data, int len) @@ -124,3 +130,16 @@ tcp_force_send(int sck, char* data, int len) return 0; } + +/*****************************************************************************/ +int DEFAULT_CC +tcp_bind(int sck, char* addr, char* port) +{ + struct sockaddr_in s; + + memset(&s, 0, sizeof(struct sockaddr_in)); + s.sin_family = AF_INET; + s.sin_port = htons(atoi(port)); + s.sin_addr.s_addr = inet_addr(addr); + return bind(sck, (struct sockaddr*)&s, sizeof(struct sockaddr_in)); +} -- cgit v1.2.3