Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> Accept(): Invalid Argument?
bonhomme
post Jul 27 2004, 12:22 PM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 2
Joined: 28-June 04
Member No.: 3,247



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:

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)
  {
     perror("accept()");
     exit(1);
  }

/* irrelevant code follows */


Anyone have any suggestions? Thanks.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 13th December 2017 - 09:40 PM