CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002
    Posts
    65

    Server closing after running only once

    Hi.

    In the file transfer client-server program (Socket Programming) I wrote, the server program is closing after only one transfer has been made. I want my server program to run all the time and continously accept client requests.

    Can someone plz help me and tell me what to do?

    Thanks

  2. #2
    Join Date
    Apr 2001
    Location
    South Africa, Jo'burg
    Posts
    680
    Hi,

    Without seeing the code I'm going to take a guess at this, you are only accepting client connections once, possibly in a constructor or so. What you could do is extend Thread or implement Runnable and in the run method continually call the ServerSocket.accept() method in a while loop, this way you server will continously listen for new client connections.

    Good Luck
    Byron

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured