Why do I receive Program received signal SIGABRT, Aborted?

Yea but i want to receive from mush clients. I haven't planned on making a client for the program so I was hoping you could tell me how to receive only 12 bytes and ignore the rest. If you can't I might just make a linked list buffer. Also you wouldn't happen to know why if I receive data, why when I receive 15 bytes the program decides to recv 12 bytes then one byte at a time would you? Maybe neutronscott could help me with this just cause hes been working with the program. Any light on this subject would be awesome also.

For the third time, it doesn't work that way, period. If you only want 12 bytes, only read 12 bytes, but you have to throw away the junk after somehow. How would it possibly know which bytes were "good" and "bad"? If they're sending more than twelve bytes when only 12 were expected, wouldn't the bytes after it be garbage by definition?

Are you sure it's not an entire line, which you could wait for the newline on?

Well you may have answered my question, thats all I wanted.
Alright so does recv receive \n only at the end of a single network package or is it possable to recv
\n before the end of a single package?

your checks like if (rbytes > 13) shouldn't ever be >= 13 if you've asked recv to grab 12 bytes. without implementing a buffer for each client, i fixed the repeated errors by doing this:

  1. replaces length checks rbytes>N with index(buffer, '\n')
  2. read out socket until newline:
    else if (!index(buffer,'\n'))
    {
        char c;

        send(d->newfd, er, sizeof er, 0);
        while ((recv(d->newfd, &c, 1, 0) == 1) && (c != '\n'))
                ;
        send(d->newfd, ln, sizeof ln, 0);

probably you'd want to be more robust and check for '\r' and/or '\n' (and strip them from end of user inputted strings)

edit: a good deal of telnet clients are in line mode unless they negotiate (or are configured) for something different. but you very well could receive a character at a time. is why you'd want to put a buffer in the descr struct to copy into until '\n'

what is index(buffer, '\n')?
Heh and because you pointed that out I changed it to recv 14.

whoops. I guess POSIX 2008 depreciated it in favor of strchr(). You've got to install the libc manual pages :wink:

it'd search buffer for '\n' and return a pointer to it, otherwise NULL. so is way to see if you got the entire line if the newline is in the first 12 byte. otherwise, you've a line that's too long waiting to be read and nowhere to put it. so you've got to recv() until you read the newline, or that data will still be there next time you enter your function. changing it to 14 won't help. then you'd still enter the function again with more of the partial line in the sockets receive buffer...

No I changed it to 14 to tell myself if they entered 12 characters or not heh,.
U fixed my connection problem real good.
I'm still trying to understand and duplicate it.
And thank you.