X-Git-Url: http://git.thejh.net/?p=libjh.git;a=blobdiff_plain;f=net.c;h=2fba39ada9b800539d6e6964aac052af3311b2fd;hp=d9b2d43493c1a116a11a0f421b6d9432960926d0;hb=1229433782ff62943a778a8fdbf100bff6007493;hpb=e441982fc2b9881df7670340e4189709b554b25b diff --git a/net.c b/net.c index d9b2d43..2fba39a 100644 --- a/net.c +++ b/net.c @@ -39,3 +39,11 @@ err_socket: freeaddrinfo(addrs); return EAI_SYSTEM; } + +PUBLIC_FN int fnetopen(FILE **in, FILE **out, const char *node, const char *service, const struct addrinfo *hints) { + int fd = netopen(node, service, hints); + if (fd < 0) return EAI_SYSTEM; + int ret = fopen_bistream(in, out, fd, 0); + if (ret) close(fd); + return ret; +} \ No newline at end of file