Implemented initial UDP socket.

yamux
Jose Marcial Vieira Bisneto 2016-11-10 19:43:31 -03:00
parent 648982793c
commit 2b55ebfeb4
2 changed files with 18 additions and 0 deletions

View File

@ -13,4 +13,6 @@
int socket_tcp4(void);
int socket_stream_sctp4(void);
int socket_udp4(void);
#endif // P2PNET_H

16
net/udp.c Normal file
View File

@ -0,0 +1,16 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include "p2pnet.h"
/* Create a UDP socket.
*/
int socket_udp4(void)
{
int s;
s = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (s == -1) return -1;
return s;
}