[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

Re: Winsock control problem

Asked by smkkaleem in Visual Basic Programming, Winsock

Tags: memory, out

I have written three applications to transfer data from remote Clients to the Central Server and then back from Central Server to the remote Clients. The Server simply listens for incoming connections from any of the remote Clients.  When a request for connection comes in, the Server starts a new Host in a separate thread.  The Host then starts a winsock control in listening mode, tells the Server what Port it is listening on, which in turn tells the Client which port it should connect to.  The Client then closes its connection with the Server, then starts a new connection with the Host.  Once connected, the data synchronization can begin as normal.  Once the Synchronization is complete, the Client closes its connection with the Host.  At that time, the Host is unloaded.

The host that the server creates is an ActiveX EXE called cWinsock and the Server application previously sets a reference to that EXE to use its methods. Following is the code that i used in the server application:

Dim WinsockHost As cWinsockHost, LoadF As cWinsockHost
   
       
        Set LoadF = New cWinsockHost
        LoadF.Load      

Note: The load method simply loads the main form of the host. The form must be loaded otherwise if the remote Client tries to connect repeatedly after a certain set interval of time, the connection is successful only few times. Afterwards, the Server application sends a zero port number back to the client and the client's connection to the host is unsuccessful, the host erroring with the following message:

"Socket not bound, invalid address or the listen is not invoked prior to accept"
 
        Set WinsockHost = New cWinsockHost
        lngPort = WinsockHost.Listen     'the listen method shows the main form, starts a winsock control in listening mode and tells the Server what Port it is listening on
        For i = 0 To MAX_SESSIONS
            If Winsock2(i).State = sckClosed Then
                Winsock2(i).Accept requestID
                Me.Winsock2(i).SendData "PORT" & lngPort
                Set LoadF = Nothing
                Set WinsockHost = Nothing
                DoEvents
                Exit For
            End If
        Next i
   

Everything seems to work OK with one exception. The server is left overnight in listening mode. The Client is set to automatic synchronization mode and initiates connection every 15 minutes or 30 minutes to the server. When a request for connection comes in, the Server starts a new Host in a separate thread.  In doing so, the server first calls the load method to load the Host main form and then calls the Listen method to request the Host to start a winsock control in listening mode, and to inform the Server what Port the host is listening on (as explained above). The problem that i am encountering is that after 10 or 15 times of connections initiated by the client, the memory consumption on the server machine gradually increases to a point that the server refuses to accept any connection requests from the client and gives an OUT OF MEMORY  message. I could not figure out yet why is it so as i am setting the host created to nothing after each connection. Can someone pinpoint the problem or any suggesssions regarding that issue. I will appreciate that.

Thanks,
[+][-]10/03/00 06:14 AM, ID: 4553301Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Visual Basic Programming, Winsock
Tags: memory, out
Sign Up Now!
Solution Provided By: anthonyc
Participating Experts: 3
Solution Grade: A
 
[+][-]10/03/00 06:28 AM, ID: 4553581Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]10/03/00 06:29 AM, ID: 4553591Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]10/03/00 08:04 AM, ID: 4556099Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/03/00 08:07 AM, ID: 4556130Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]10/03/00 10:32 AM, ID: 4558606Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]10/03/00 11:50 AM, ID: 4560303Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/03/00 12:14 PM, ID: 4560841Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/05/00 08:28 AM, ID: 4594911Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/05/00 09:08 AM, ID: 4595501Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/26/01 01:52 AM, ID: 5878535Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/27/01 11:33 AM, ID: 6126620Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89