Thread: server won't respond...

  1. #1
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708

    Question server won't respond...

    I am connecting a client to a server via the loopback. The client is well tested and sends/recieves normally. The server acknowledges the connection (as does the client), but when I send the first packet to the server, it just sits there, dutifully awaiting data. No recieve error, and no 0 recieves. The client assures "Waiting for reply...", but that's it. When I kill the server, the client promtly notifies that the connection was lost. Any ideas?
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Ok, wierd. when I close the client's socket directly after sending the data, the server acknowledges the reciept. Paradoxically, I cannot recieve the server's response now, since the client was using that socket for recieving too. No problem, just'll use another, but the thing that doesn't make sense is that the client connects to external servers without shutting down after the send (I do it after the recieve). Why is my server different? because it too is using a single socket?? Not sure, there...
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708

    Smile got it

    Thanks sebastiani
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  4. #4
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    Glad to be of service.

  5. #5
    where did you learn the socket programming? I have wanted to learn itr for a long time, and what compiler are you using?
    Compilers:
    GCC on Red Hat 8.1 (Primary)
    GCC on Mac OS X 10.2.4 (Secondary)

    Others:
    MinGW on XP

  6. #6
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    The Winsock Faq has some really good examples. There use to be a site called Beej's that had all kinds of fun hacks, but it seems to have dissapeared. You can use the compiler you're using, just #include <winsock.h> in your projects and link to the static library, "libwsock32.a". To do that, go to Project->Project Options, and in the box labeled "Further object files or linker options...", type this line, verbatim:
    -lwsock32
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  7. #7
    THANKS MAN!

    I have been looking for that stuff for a log time, and you managed o tell me in less thatn a paragraph...

    thanks.

    ~Inquirer
    Compilers:
    GCC on Red Hat 8.1 (Primary)
    GCC on Mac OS X 10.2.4 (Secondary)

    Others:
    MinGW on XP

  8. #8
    hehehe...

    any good books to suplement this? i think i am in way over my head...
    Compilers:
    GCC on Red Hat 8.1 (Primary)
    GCC on Mac OS X 10.2.4 (Secondary)

    Others:
    MinGW on XP

  9. #9
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >There use to be a site called Beej's that had all kinds of fun hacks, but it seems to have dissapeared.
    http://www.ecst.csuchico.edu/~beej/guide/net/html/

    -Prelude
    My best code is written with the delete key.

  10. #10
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Thanks, Prelude. I'll update my bookmark.

    any good books to suplement this? i think i am in way over my head...
    You will be pleasantly surprised by the simplicity of it all.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  11. #11
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Another good starting point for general TCP/IP help:
    http://www.private.org.il/tcpip_rl.html
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  12. #12
    Dang. I have already created a simple telnet program that shows all telnet input to the cout, and it is written to a file. Now, where can i find out how to make threads so that i can make multiple connections to the program?
    Compilers:
    GCC on Red Hat 8.1 (Primary)
    GCC on Mac OS X 10.2.4 (Secondary)

    Others:
    MinGW on XP

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. server client application - (i really need your help)
    By sarahnetworking in forum C Programming
    Replies: 3
    Last Post: 03-01-2008, 10:54 PM
  2. Server Architecture
    By coder8137 in forum Networking/Device Communication
    Replies: 2
    Last Post: 01-29-2008, 11:21 PM
  3. Where's the EPIPE signal?
    By marc.andrysco in forum Networking/Device Communication
    Replies: 0
    Last Post: 12-23-2006, 08:04 PM
  4. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM
  5. socket question
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 07-19-2002, 01:54 PM