Winsock...need solution by tomorrow morning.

OKay my problem goes like this...

I need to use winsock to do post method.
It works for one submission, but when I just change the variable and send another post.. it gave an error even though the first connection was properly close. The problem is fixed when I put two winsock ocx...

Is there any way to fix it so that I don't have to put new winsock everytime.

Or worse come to worse is it possible to create and destroy controls on the fly?

my ICQ # is 22193734

holy_bellAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

stefanxCommented:
Seeing that you need this by tomorrow...

Put a Winsock COntrol on a form. Change its index property to 0. Now, when you want to do a post, first load a new instance of the control by saying :

Load Winsock1(1)
Do the rest of your stuff

On the Close event of the control, unload Winsock1(1).

This is a cheap and nasty trick that I found works when using the WInsock control. I don't know why it exhibits the work-once-only behaviour.

Hope that helps


0
mcriderCommented:
Try this:

Add the winsock control to your form with an INDEX of 0.

Then do this to create a new control, use it, then delete it:

   Dim iVal as Long
   Ival=Winsock1.Count
   Load Winsock1(iVal)
   'use the control...
   Unload Winsock1(iVal)


Cheers!
0
holy_bellAuthor Commented:
Since both of you gave pretty much the same solution I will have to split it tp 200 and 200.... I will test it out first gimme a minute....
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

holy_bellAuthor Commented:
Yepp I get another dasy to do it... there is something in Microsoft's KB claiming that this is a bug with winsock that comes with vb5 and 6
0
holy_bellAuthor Commented:
NO those extra additional control don't work
0
Dustin_KreftCommented:
Make sure the server knows that you disconnected. So it knows that it has to reset that port and invoke the listen command.
0
holy_bellAuthor Commented:
mcrider please resend you answers... I think I got it to work some how... But I will still give off the point....
0
mcriderCommented:
Reposting for points...


Cheers!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
stefanxCommented:
Hmm - I think this is a trifle unfair, especially since my answer was posted before McRiders...
0
holy_bellAuthor Commented:
stefanx , Sorry I can't give you any points cos' you put yours as a comment....
0
mcriderCommented:
Thanks for the points! Glad I could help!


Cheers!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.