#include #include #include #include #define PORT 8080 int main() { int sockfd = socket(AF_INET, SOCK_STREAM, 0); if(sockfd == -1) { perror("webserve (socket)"); return 1; } printf("socket created successfully\n"); struct sockaddr_in host_addr; int host_addrlen = sizeof(host_addr); host_addr.sin_family = AF_INET; host_addr.sin_port = htons(PORT); host_addr.sin_addr.s_addr = htonl(INADDR_ANY); if(bind(sockfd, (struct sockaddr *)&host_addr, host_addrlen) != 0) { perror("webserver (bind)"); return 1; } printf("socket successfully bound to address\n"); return 0; }