tonk

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

tonk_srv.c (387B)


      1 #include <stdlib.h>
      2 #include <sys/socket.h>
      3 #include <arpa/inet.h>
      4 #include <stdio.h>
      5 
      6 #include "tonk.h"
      7 
      8 #define PORT 25566
      9 
     10 int
     11 main() {
     12 	struct sockaddr_in addr = {
     13 		AF_INET,
     14 		htons(PORT),
     15 		INADDR_ANY
     16 	};
     17 	int s = socket(AF_INET, SOCK_STREAM, 0);
     18 	if (bind(s, (struct sockaddr *)&addr, sizeof(addr))) {
     19 		perror("bind: ");
     20 		exit(1);
     21 	}
     22 	listen(s, 10);
     23 
     24 	int p1, p2;
     25 
     26 	close(s);
     27 }