Results 1 to 5 of 5

Thread: Multiple winsock memory error

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 1999
    Posts
    39
    I am using multiple winsocks in my app.

    All is good until I unload my winsocks like this:

    for i = 1 to 50
    unload winsock(i)
    next i

    while it is unloading, I frequently get an error like:

    Memory xxxxxx referenced memory at xxxxxxx. Memory cannot be "Read".




    I found out that SP4 for Visual Studio should fix this problem. I installed the Service Pack and this problem is still popping up. Can anyone help me get rid of this stupid error!

    [email protected]
    http://www.hackvp.com
    I may be dumb, but I am not stupid!



  2. #2
    Fanatic Member Dim's Avatar
    Join Date
    Jul 2000
    Posts
    620
    Could it be that you are trying to "unload" then too fast. Try using DoEvents some place in the uploading statement to slow it down.

    Gl,
    D!m

    Dim

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 1999
    Posts
    39
    Sorry, i was just using that code as an example

    The exact code is:
    Code:
    For i = 1 To 500
        Unload Winsock1(i)
        DoEvents
    Next i

    Anyone know why i am still getting that wierd error?
    [email protected]
    http://www.hackvp.com
    I may be dumb, but I am not stupid!



  4. #4
    Guest
    i think,that you can max open 49 sockets with the winsock ocx. dont ask me why .....


  5. #5
    Addicted Member
    Join Date
    Apr 2000
    Posts
    215
    no you can open hundreds or even thousands of sockets with the winsock control just to test this to make sure I wasnt lieing with out it heh I just made a loop to open 37000 sockets, I will probably run out of memory or something before its finished but it is up to 5000 winsock sockets opened now and is running fine.

    but I just also loaded 500 winsocks and then unloaded them again (same method as you) and I didn't get the memory error, I have sp4 installed but my winsock control is the old version than orignally came with vb6 as some program I installed saved the old winsock control over the new one.

    maybe its just your computer? or have you tried it on other people and it has performed an error?

    but one thing that might be making this is you haven't closed the winsock control before you try to unload them try this:

    Code:
    For i = 1 To 500
        Winsock1(i).Close
        Unload Winsock1(i)
        DoEvents
    Next i
    thats the only thing I can think of that might be causing this problem.





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