version 1.1.2.2, 2011/11/30 00:12:30
|
version 1.1.2.3, 2011/12/14 15:09:31
|
Line 12 srv_Socket(sl_config * __restrict cfg)
|
Line 12 srv_Socket(sl_config * __restrict cfg)
|
struct sockaddr_in *sin = (struct sockaddr_in*) &ss; |
struct sockaddr_in *sin = (struct sockaddr_in*) &ss; |
struct sockaddr_in6 *sin6 = (struct sockaddr_in6*) &ss; |
struct sockaddr_in6 *sin6 = (struct sockaddr_in6*) &ss; |
|
|
|
ioTRACE(2); |
|
|
cfg_LoadAttribute(cfg, CFG("mqttd"), CFG("port"), CFG(szStr), sizeof szStr, MQTT_PORT); |
cfg_LoadAttribute(cfg, CFG("mqttd"), CFG("port"), CFG(szStr), sizeof szStr, MQTT_PORT); |
port = strtol(szStr, NULL, 0); |
port = strtol(szStr, NULL, 0); |
cfg_LoadAttribute(cfg, CFG("mqttd"), CFG("listen"), CFG(szStr), sizeof szStr, MQTT_HOST); |
cfg_LoadAttribute(cfg, CFG("mqttd"), CFG("listen"), CFG(szStr), sizeof szStr, MQTT_HOST); |
Line 39 srv_Socket(sl_config * __restrict cfg)
|
Line 41 srv_Socket(sl_config * __restrict cfg)
|
return -1; |
return -1; |
} |
} |
|
|
s = socket(ss.ss_family, SOCK_STREAM, IPPROTO_TCP); | s = socket(ss.ss_family, SOCK_STREAM, 0); |
if (s == -1) { |
if (s == -1) { |
printf("Error:: socket() #%d - %s\n", errno, strerror(errno)); |
printf("Error:: socket() #%d - %s\n", errno, strerror(errno)); |
return -1; |
return -1; |
Line 61 srv_Socket(sl_config * __restrict cfg)
|
Line 63 srv_Socket(sl_config * __restrict cfg)
|
int |
int |
srv_Close(int s) |
srv_Close(int s) |
{ |
{ |
shutdown(s, SHUT_RDWR); | ioTRACE(2); |
| |
| if (s > STDERR_FILENO) |
| shutdown(s, SHUT_RDWR); |
| |
return close(s); |
return close(s); |
} |
} |