Archived Forum Post

Index of archived forum posts

Question:

socket vb6

Oct 12 '17 at 12:07

Hi,

I have a following little code for server side:

Dim listenSocket As New ChilkatSocket
Dim success As Long
success = listenSocket.BindAndListen(8051, 25)
Dim connectedSocket As ChilkatSocket
Do
Set connectedSocket = listenSocket.AcceptNextConnection(0)
seg$ = connectedSocket.ReceiveUntilMatch("¤¤¤END¤¤¤")
success = connectedSocket.Close(50)
Set connectedSocket = Nothing
If Left(seg$, 4) = "STOP" Then Exit Do d = DoEvents
Loop

It works fine but i can stop the running of the code in VB6 design mode when i send the 'STOP' word from the client side. The Ctrl+Break key combination dont't work so i can't switch to debug mode. What should i change for a breakable code? Thanks for your answer.

Best regards:

Máté György


Answer

I tried your code and it work if I typed:

STOP¤¤¤END¤¤¤

Since you are waiting on "¤¤¤END¤¤¤", you have to make sure to send that string to return control to your code.