Printable Version of Topic

Click here to view this topic in its original format

Linuxhelp _ Programming in Linux _ Accept(): Invalid Argument?

Posted by: bonhomme Jul 27 2004, 12:22 PM

Hi guys,

I'm trying to create a simple server using C. I'm running RH 7.2. When my code runs the following code segment, it returns with the following error:

accept(): invalid argument

I'm not sure why I'm getting this message since my arguments seem to be of the correct type. Anyway, here's my code:

for (;;)
  struct sockaddr_in clientName = {0};
  int slaveSocket, clientLength = sizeof(clientName);

  (void) memset(&clientName, 0, sizeof(clientName));

  slaveSocket = accept(serverSocket, (struct sockaddr *) &clientName, &clientLength);

  if (-1 == slaveSocket)

/* irrelevant code follows */

Anyone have any suggestions? Thanks.

Powered by Invision Power Board (
© Invision Power Services (