• Welcome to Valhalla Legends Archive.
 

URLS in winsock

Started by brew, April 14, 2007, 11:05 AM

Previous topic - Next topic

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 -.-
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

Barabajagal

Uhm... Never happens for me.

l2k-Shadow

#2
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
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

brew

You know what, vb6 is sooo limited. I'm honestly thinking about converting to C++ completely.
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

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...

l2k-Shadow

Quote from: brew on April 14, 2007, 12:27 PM
You know what, vb6 is sooo limited. I'm honestly thinking about converting to C++ completely.

Smart choice :)
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

Joe[x86]

If you don't know why the Winsock stops working when you unload your Form, you should not even consider considering C++.
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

Grok

Quote from: Joex86] 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++.

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++.

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.

Explicit

Quote from: RεalityRipplε on April 16, 2007, 12:21 AM
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.

It would also involve how the objects free memory.
I'm awake in the infinite cold.

[13:41:45]<@Fapiko> Why is TehUser asking for wang pictures?
[13:42:03]<@TehUser> I wasn't asking for wang pictures, I was looking at them.
[13:47:40]<@TehUser> Mine's fairly short.

Grok

Quote from: RεalityRipplε on April 16, 2007, 12:21 AM
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.

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.

brew

Here ya' go:
http://freewebs.com/brew1337/test.zip
Just unload the form by "x-ing it out"
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

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.

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.
Quote from: Hazard on August 07, 2003, 03:15 PM
Highlight your entire code. Press the delete key. Start over again using Cuphead's CSB tutorial and work your way from their rather than raping code from downloaded sources meant purely for learning purposes. If this does not fix the problem, uninstall Visual Basic and get a new hobby. I suggest Cricket.

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.
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P