@@ -575,6 +575,9 @@ static void fill_io_type(hio_t* io) {
default: io->io_type = HIO_TYPE_FILE; break;
}
+ else {
+ io->io_type = HIO_TYPE_TCP;
+ }
static void hio_socket_init(hio_t* io) {
@@ -1,5 +1,6 @@
#include <stdio.h>
#include "icmp.h"
+#include "hplatform.h"
int main(int argc, char* argv[]) {
if (argc < 2) {
@@ -7,6 +8,11 @@ int main(int argc, char* argv[]) {
return -10;
+#ifdef OS_WIN
+ WSADATA wsadata;
+ WSAStartup(MAKEWORD(2,2), &wsadata);
+#endif
+
char* host = argv[1];
int ping_cnt = 4;
int ok_cnt = ping(host, ping_cnt);
@@ -3,6 +3,11 @@
#include "hsocket.h"
int sockfds[2];
if (Socketpair(AF_INET, SOCK_STREAM, 0, sockfds) != 0) {
printf("socketpair failed!\n");