Results 1 to 4 of 4

Thread: [RESOLVED] server/client whats wrong with this code?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Resolved [RESOLVED] server/client whats wrong with this code?

    whenever i try this i get an error:
    "Runtime error 40006
    Wrong protocol or connection state for the requested transaction or request"

    could someone tell me whats wrong with this code?

    Code:
    Dim MessageIn As String
    Dim MessageOut As String
    
    Private Sub Command1_Click()
    MessageOut = txtOut
    Winsock1.SendData MessageOut
    End Sub
    
    Private Sub Form_load()
    Winsock1.RemoteHost = "localhost"
    Winsock1.RemotePort = "65256"
    Winsock1.Connect
    Winsock2.LocalPort = "65256"
    Winsock2.Listen
    End Sub
    
    
    Private Sub Winsock2_DataArrival(ByVal bytesTotal As Long)
    Winsock2.GetData MessageIn
    txtIn = txtIn & MessageIn & vbNewLine
    End Sub

  2. #2
    Hyperactive Member Philly0494's Avatar
    Join Date
    Apr 2008
    Posts
    485

    Re: server/client whats wrong with this code?

    when and where does the error occur?

    it could be because you are trying to Connect before you tell you server to Listen

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: server/client whats wrong with this code?

    i tried to reverse it, and even make it connect from a button click.

    i get the error when i click command1 (send data)

    but i got it working now...

  4. #4
    Junior Member
    Join Date
    Nov 2009
    Posts
    22

    Re: [RESOLVED] server/client whats wrong with this code?

    Can you post the full code for the above program

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width