Vb6 : A Simple Winsock Connection !

04/12/2009 19:30 daniellook#1
I made a little tut for a simple winsock connection
In visual basic 2006 !
So here it comes

Start with opening vb6
[Only registered and activated users can see links. Click Here To Register...]

Now open Standard EXE
[Only registered and activated users can see links. Click Here To Register...]

Now look at the right and right mouse click there
And Choose Compoments
[Only registered and activated users can see links. Click Here To Register...]

Now Scroll down till Microsoft Winsock Control 6.0
And Check it !
[Only registered and activated users can see links. Click Here To Register...]

And click ok

Now Add 2 off those Winsock things !

[Only registered and activated users can see links. Click Here To Register...]

Ok Now the fun part starts :)

Now rename the first one to "WsCon" ( Without the ")
Now rename the second one to "WsServ" ( Without the ")

[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]

Now change the port of wsServ to 1566
[Only registered and activated users can see links. Click Here To Register...]

Now Double Click the form1
And type : wsServ.lisen
[Only registered and activated users can see links. Click Here To Register...]

Now Let's make a textbox
Dont need pic for that :p
Make the multiline to True
And remove the text

Now create 2 Command Buttons
the first one with "Connect"
And the second on with "DisConnect"
Now double click the connect button and type
wscon.connect "127.0.0.1", 1566
Now double click the wsCon
And Right Above u'll see Error now go to connect.
Then delete the line below it !
Now type in wsCon_Connect()
txt1.text = text1.text & "Succesfully Connected" &Vbcrlf

Now Close that code
now double click disconnect and type in
wsCon.close
thats all for that now
Now close that code and double click wsServ
U'll see right above error again
Now go to Connection Requested and delete the line below
Type in the Connection Requested now :
If wsServ.state <> sckclosed then
wsServ.close
wsServ.accept requestiD
End if

So now thats done

Now double click the Dissconnect button and type there :
txt1.text = text1.text & "Succesfully DisConnected" &Vbcrlf
This must below to the Wscon.close

Now Start Program and test :)
GL yaáll !