Overview
Comment: | Updated to support addresses specified in IPv4 style (in which case only IPv4 is used) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
0bbc3f5bbac994fdb65c688a5cd151db |
User & Date: | rkeene on 2014-02-08 03:36:30 |
Other Links: | manifest | tags |
Context
2014-02-08
| ||
03:55 | Added README check-in: ab9592633a user: rkeene tags: trunk | |
03:36 | Updated to support addresses specified in IPv4 style (in which case only IPv4 is used) check-in: 0bbc3f5bba user: rkeene tags: trunk | |
03:17 | Updated to more safely generate mimetypes file check-in: cbe7d25150 user: rkeene tags: trunk | |
Changes
Modified filed.c from [6f13628165] to [5e70bdaf5f].
︙ | ︙ | |||
144 145 146 147 148 149 150 | } return(0); } /* Listen on a particular address/port */ static int filed_listen(const char *address, unsigned int port) { | | > > > > > | | | | | | | | > > > > > > > > > > > > > > > | | | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | } return(0); } /* Listen on a particular address/port */ static int filed_listen(const char *address, unsigned int port) { struct sockaddr_in6 addr_v6; struct sockaddr_in addr_v4; struct sockaddr *addr; socklen_t addr_len; int pton_ret, bind_ret, listen_ret; int family; int fd; family = AF_INET6; pton_ret = inet_pton(family, address, &addr_v6.sin6_addr.s6_addr); if (pton_ret != 1) { family = AF_INET; pton_ret = inet_pton(family, address, &addr_v4.sin_addr.s_addr); if (pton_ret != 1) { return(-1); } addr_v4.sin_family = family; addr_v4.sin_port = htons(port); addr = (struct sockaddr *) &addr_v4; addr_len = sizeof(addr_v4); } else { addr_v6.sin6_family = AF_INET6; addr_v6.sin6_flowinfo = 0; addr_v6.sin6_scope_id = 0; addr_v6.sin6_port = htons(port); addr = (struct sockaddr *) &addr_v6; addr_len = sizeof(addr_v6); } fd = socket(family, SOCK_STREAM, 0); if (fd < 0) { return(fd); } bind_ret = bind(fd, addr, addr_len); if (bind_ret < 0) { close(fd); return(-1); } listen_ret = listen(fd, 128); |
︙ | ︙ |