-#if defined(CONFIG_WINCE)
- return timeGetTime() * int64_t_C(1000);
-#elif defined(__MINGW32__)
- struct timeb tb;
- _ftime(&tb);
- return ((int64_t)tb.time * int64_t_C(1000) + (int64_t)tb.millitm) * int64_t_C(1000);
+ unsigned int add1 = 0, add2 = 0, add3 = 0, add4 = 0;
+
+ if (sscanf(str, "%d.%d.%d.%d", &add1, &add2, &add3, &add4) != 4)
+ return 0;
+
+ if (!add1 || (add1|add2|add3|add4) > 255) return 0;
+
+ add->s_addr=(add4<<24)+(add3<<16)+(add2<<8)+add1;
+
+ return 1;
+}
+#endif /* !defined(HAVE_INET_ATON) */
+
+/* resolve host with also IP address parsing */
+int resolve_host(struct in_addr *sin_addr, const char *hostname)
+{
+ struct hostent *hp;
+
+ if (!inet_aton(hostname, sin_addr)) {
+ hp = gethostbyname(hostname);
+ if (!hp)
+ return -1;
+ memcpy(sin_addr, hp->h_addr, sizeof(struct in_addr));
+ }
+ return 0;
+}
+
+int ff_socket_nonblock(int socket, int enable)
+{
+#ifdef HAVE_WINSOCK2_H
+ return ioctlsocket(socket, FIONBIO, &enable);