|
@@ -42,7 +42,7 @@ int net_sock(int type, int port) {
|
|
|
int reuseaddr = 1;
|
|
|
struct sockaddr_in addr;
|
|
|
|
|
|
- if ((fd = socket(AF_INET, (type == 1 ? SOCK_STREAM : SOCK_DGRAM), 0)) == -1) {
|
|
|
+ if ((fd = socket(AF_INET, (type == 1 ? SOCK_STREAM : SOCK_DGRAM), (type == 1 ? IPPROTO_IP : IPPROTO_UDP))) == -1) {
|
|
|
perror("Unable to create net socket");
|
|
|
return -1;
|
|
|
}
|