Thread: Socket abruptly closes after function ends

  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    22

    Socket abruptly closes after function ends

    Code:
    class Net{
    Create();
    Connect();
    SOCKET s;
    ...
    }
    
    main() {
    Net n;
    n.Create();
    n.Connect();
    }
    When I put a breakpoint on the last line of the Create function, the socket is fine. However, as soon as that function ends before I even call Connect, the socket has closed.

  2. #2
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    Well seeing as how my mindreading abilities have been on the fritz lately and I am not skilled enough to hack into your computer over the Internet, would you be so kind as to post the code in question so those of us willing to help might be able to have a little bit of a fighting chance?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. shutdown function socket programming
    By 256Doofus in forum Networking/Device Communication
    Replies: 0
    Last Post: 10-26-2008, 04:47 AM
  3. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  4. Calling a Thread with a Function Pointer.
    By ScrollMaster in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2006, 08:56 AM
  5. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM