Problems with sockets.

Problems with sockets.

Post by Sean M Cast » Sat, 20 Feb 1993 04:07:00

Hi, I'm trying to write a smaller version of telnet with some special
little add-ins but I'm running into a problem with lines that have no
new lines at the end; I can't read them until a new line has been
sent.  For example, I wrote a small multi-user talk program that has a
login prompt.  When using my program right now to telnet to it, I get
all of the intro message, but the login prompt does not appear because
of no newline.  Is there some special way that I can read it without
having to have a newline be sent?  Any help would be great.  Email
would be best since I don't read this group very often.  I would post
the program, but it's a terrible mess.


1. Question: Problem with socket, socket system call returns 0

   Ok my problem is this I have tried to bind a socket but the bind
system call
return -1 and errno is set to 88 (it is not a valid socket descriptor).
Debugging my piece of code I have discovered that before the socket
system call returns 0. Is this a valid socket
descriptor ? I' m working as not root user and I have tried to bind the
socket on different ports for example 6969 etc..
The piece of code is something like this:

sockaddr_in addr;

int main() {

    if ((sock = (AF_INET, SOCK_STREAM, 0))  ==  -1) {
       fprintf(stderr, "Socket creation error errno is %i\n", errno);
       return -1;
   /* from now sock is = 0 */

   addr.sin_family = AF_INET;
   addr.sin_port = htons(6969);
   addr.sin_addr.s_addr = INADDR_ANY;
   bzero(&(addr.sin_zero), 8);

   if ((bind(sock, (struct sockaddr *)&addr, sizeof(sockaddr_in))) ==
-1) {
       fprintf(stderr, "Binding error errno is %i\n", errno);
       return -1;
     /* Here the program exit with errno set to 88 */

    return 0;

Thanks to everyone can help me


2. What Should I do now?

3. Problem: getpeername: Socket operation on non-socket

4. Is my SCSI Card compatable?

5. Soundex fingerd + NIS server anyone?

6. problem with socket code (well, it uses socket libraries anyway)

7. Is it safe to mount /usr/spool/mail?

8. Problems in socket

9. Problem on Sockets

10. a basic problem about socket and select

11. Problems with socket

12. Problem with socket closure in 2.2 kernel?