21 lines
412 B
C
21 lines
412 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include "sockets.h"
|
|
|
|
int main(int argc, char *argv[]) {
|
|
if (argc != 2) {
|
|
printf("Usage: %s <port>\n", argv[0]);
|
|
exit(1);
|
|
}
|
|
|
|
int port = atoi(argv[1]);
|
|
int serv_sock = tcp_listen(port);
|
|
int clnt_sock = tcp_accept(serv_sock);
|
|
|
|
process_request(clnt_sock);
|
|
close(clnt_sock);
|
|
close(serv_sock);
|
|
return 0;
|
|
}
|