thermferm/server.c

changeset 52
4387a6b11eb3
parent 51
a03b6dac5398
child 53
37623517e0ef
equal deleted inserted replaced
51:a03b6dac5398 52:4387a6b11eb3
121 121
122 122
123 123
124 void cmd_server(void) 124 void cmd_server(void)
125 { 125 {
126 char *inp, *hostname, buf[SS_BUFSIZE], obuf[SS_BUFSIZE]; 126 char *inp, buf[SS_BUFSIZE], obuf[SS_BUFSIZE];
127 int i, rc, rlen; 127 int i, rc, rlen;
128 socklen_t fromlen; 128 socklen_t fromlen;
129 float newtemp; 129 float newtemp;
130 130
131 hp = gethostbyaddr ((char *) &peeraddr_in.sin_addr, sizeof(struct in_addr), peeraddr_in.sin_family);
132 if (hp == NULL) {
133 hostname = inet_ntoa(peeraddr_in.sin_addr);
134 } else {
135 hostname = hp->h_name;
136 }
137
138 // if (debug) { 131 // if (debug) {
132 // char *hostname = inet_ntoa(peeraddr_in.sin_addr);
139 // syslog(LOG_NOTICE, "Start new client connection from %s port %u", hostname, ntohs(peeraddr_in.sin_port)); 133 // syslog(LOG_NOTICE, "Start new client connection from %s port %u", hostname, ntohs(peeraddr_in.sin_port));
140 // fprintf(stdout, "Start new client connection from %s port %u\n", hostname, ntohs(peeraddr_in.sin_port)); 134 // fprintf(stdout, "Start new client connection from %s port %u\n", hostname, ntohs(peeraddr_in.sin_port));
141 // } 135 // }
142 136
143 memset((char *)&buf, 0, SS_BUFSIZE); 137 memset((char *)&buf, 0, SS_BUFSIZE);

mercurial