1
edit
Changes
no edit summary
#include <sys/poll.h>
#include <sys/poll.h>
int main (int argc, char *argv[])
{
error (EXIT_FAILURE, errno, "getservent");
struct pollfd fds[1];
int nfds = 0;
fds[nfds].fd = socket (AF_INET, SOCK_STREAM, 0);
if (fds[nfds].fd == -1)
error (EXIT_FAILURE, errno, "socket");
struct sockaddr_in sin;
sin.sin_family = AF_INET;
sin.sin_port = s->s_port;
sin.sin_addr.s_addr = INADDR_ANY;
if (bind (fds[nfds].fd,
&sin, sizeof (sin)) != 0)
error (EXIT_FAILURE, errno, "bind");
if (listen (fds[nfds].fd, SOMAXCONN) != 0)
error (EXIT_FAILURE, errno, "listen");
++nfds;
int i = 0;
while (1)
{
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <netinet/in.h>
#include <sys/socket.h>
int main (int argc, char *argv[])
{
{
int sock = socket (PF_INET, SOCK_STREAM, 0);
if (sock != -1)
{
error (0, 0, "cannot contact %s", argv[1]);
result = 1;
return result;
}