Linux Network Programming: send() crashes program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kardon33
    New Member
    • May 2007
    • 158

    Linux Network Programming: send() crashes program

    Hello Bytes,

    I am writing a network program in c++ on Linux Debian x86.

    I am using tcp sockets to communicate with other processors all very standard stuff.

    However Im stuck at one hump, when I try to call send() on a socket where the other machine loss power of crashed. Send crashes my program, no return of -1 just crash with no output.

    My Send Command:
    Code:
     if (send(vars->Nodes[n].sockfd, buf3, strlen(buf3), 0) == -1) {
           vars->Nodes[n].ready = 0;
           vars->Nodes[n].connected = 0;
           perror("sendTimeCode");
     }
    Any thoughts?
  • kardon33
    New Member
    • May 2007
    • 158

    #2
    Nevermind, my dumb mistake.

    It was throwing a connection reset by peer error but I missing it and the next time I called send() it crashed which is ok.

    Comment

    Working...