Valhalla Legends Forums Archive | Visual Basic Programming | Re: URLS in winsock

AuthorMessageTime
BreW
Did anyone ever wonder, why, if you connect to a text ip/url/whatever you want to call it such as bnls.valhallalegends.com with a winsock, it works fine, until you try to unload your form. About half the time it freezes and vb6 crashes. Anyone know why, or a fix for this? (it works fine when compiled) I always end up having to put in the acual ip -.-
April 14, 2007, 4:05 PM
Barabajagal
Uhm... Never happens for me.
April 14, 2007, 4:18 PM
l2k-Shadow
that usually doesn't happen unless you try to do something that is "not what VB is for" things.. such as changing the address of the callback function so that you can parse it yourself - like when implementing winsock API into VB rather than using the control.

You could also attempt to look into getting the IP address yourself rather than letting the control do it for you, try looking into this lovely function here: http://msdn2.microsoft.com/en-us/library/ms738520.aspx
April 14, 2007, 4:41 PM
BreW
You know what, vb6 is sooo limited. I'm honestly thinking about converting to C++ completely.
April 14, 2007, 5:27 PM
Barabajagal
Since you already know some VB, try PowerBasic before moving to an entire different language family. You can find a PB download on a torrent site somewhere...
April 14, 2007, 5:35 PM
l2k-Shadow
[quote author=brew link=topic=16616.msg167950#msg167950 date=1176571651]
You know what, vb6 is sooo limited. I'm honestly thinking about converting to C++ completely.
[/quote]

Smart choice :)
April 14, 2007, 5:51 PM
JoeTheOdd
If you don't know why the Winsock stops working when you unload your Form, you should not even consider considering C++.
April 16, 2007, 3:09 AM
Grok
[quote author=Joe[x86] link=topic=16616.msg168019#msg168019 date=1176692996]
If you don't know why the Winsock stops working when you unload your Form, you should not even consider considering C++.
[/quote]

Why not?  I don't see a relationship between not understanding the internals of someone else's COM component with learning non-COM winsock programming in C++.
April 16, 2007, 5:02 AM
Barabajagal
I think it's a common sense issue... If an object contains other objects and that object disappears, it's only common sense to assume the objects contents will also disappear.
April 16, 2007, 5:21 AM
Explicit[nK]
[quote author=RεalityRipplε link=topic=16616.msg168026#msg168026 date=1176700862]
I think it's a common sense issue... If an object contains other objects and that object disappears, it's only common sense to assume the objects contents will also disappear.
[/quote]

It would also involve how the objects free memory.
April 16, 2007, 5:29 AM
Grok
[quote author=RεalityRipplε link=topic=16616.msg168026#msg168026 date=1176700862]
I think it's a common sense issue... If an object contains other objects and that object disappears, it's only common sense to assume the objects contents will also disappear.
[/quote]

Read the original post.  He's not complaining about the connection disappearing, but rather the application freezing or crashing.  Quite a different thing.

Brew, first make sure you are running Service Pack 6 for VB6 and try your program again.  Unloading the form should cause the contained controls to unload as well.  The Winsock control, being contained, should close the connection and free its resources gracefully.  If you're using an older version that was since fixed, the SP6 should help.

If that doesn't fix the problem; create a new VB6 project, add a winsock control, add minimal code to connect to bnls, then test whether you can reproduce the error.  If the sample still gets the error, post it on the forum for someone to verify your result on their own PC.
April 17, 2007, 4:52 PM
BreW
Here ya' go:
http://freewebs.com/brew1337/test.zip
Just unload the form by "x-ing it out"
April 17, 2007, 8:28 PM
Grok
Opened it in VB6, w/sp6, ran it, clicked Command1, then closed the form using the 'x' on caption bar.  No error, no crash, it just closed as I expected it to do.
April 18, 2007, 8:28 PM
Imperceptus
I have had vb6 crash or hang with use of winsock. Check the state of your socket.  You get so caught up in vb6 with do a little test then do more then test that things are still going on with winsock when you try to stop.(Atleast I think this is whats going on). I haven't found a solution.
April 18, 2007, 11:41 PM
BreW
Even with Service Pack 6, it hangs then crashes on me. However I have made another observation: When I end the program using the "stop" button on the toolbar of the VB6 IDE it seems to stop perfectly, then any other time when I run and unload the form, it works fine. But if I did not end it before unloading the form, it does the same thing. I'm really not sure what to make of this.
April 19, 2007, 1:28 AM
Imperceptus
make sure your controls aren't bound to doing anything at the moment? i dunno.
April 19, 2007, 4:26 AM
Barabajagal
You aren't subclassing, are you?
April 19, 2007, 4:45 AM

Search