aboutsummaryrefslogtreecommitdiff
path: root/socket_udp.c
diff options
context:
space:
mode:
Diffstat (limited to 'socket_udp.c')
-rw-r--r--socket_udp.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/socket_udp.c b/socket_udp.c
new file mode 100644
index 0000000..d71d3e4
--- /dev/null
+++ b/socket_udp.c
@@ -0,0 +1,17 @@
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <unistd.h>
+#include "ndelay.h"
+#include "socket.h"
+
+int socket_udp(void)
+{
+ int s;
+
+ s = socket(AF_INET,SOCK_DGRAM,0);
+ if (s == -1) return -1;
+ if (ndelay_on(s) == -1) { close(s); return -1; }
+ return s;
+}