Step 6Coding the Winsock
we need to tell it what to do when someone tries to connect and we need to tell it where to put the data it receives
ok double click on the winsock control(sckMain)
in the upper right corner of the code box it should say: error
click the drop down box and select connection request
now it should have made a new place to enter code
in there type:
If sckMain.state <> sckClose then
sckMain.close
end if
sckMain.accept requestid
txtLog = txtLog.text & "Connected to: " & sckMain.RemoteHostIP & vbcrlf
first and second lines check if the winsock(sckMain) is closed and if it is not then it closes it
third line closes the if statement
forth line tells the winsock (sckMain) to accept connections
fifth line tells you that you are connected by adding a line to txtLog
now we need to tell the winsock what to do with the data it recieves
in the top right of the code window click the drop down box and select: DataArrival
now enter this code:
dim Data as string
sckMain.getdata Data, vbstring
txtLog = txtLog.text & data & vbcrlf
first line makes data a string the sting is where the data that is received is going to be put before it is added to txtLog
second line gets the data and places it in the string data as a vbstring
third line adds the data received to txtLog
now once again if it is confusing and you have questions post comment or message me
| « Previous Step | Download PDFView All Steps | Next Step » |











































sckMain.state <> sckClose
sckMain.accept requestid
Please e-mail me with a solution asap as i really like this proggy u made!
de7ox@hotmail.com
Thanks!
sckMain.Accept(e.requestID)
sckMain.Close()
sckMain.Accept(e.requestID)
sckMain.Accept(e.requestID)
proCedure = txtLog.Text & "Connected to: " & sckMain.RemoteHostIP & vbCrLf
proCedure = txtLog.Text
you will need to fix the lines, but this is what I have.