Results 1 to 2 of 2

Thread: more winsock

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    Oshawa, Ontario, Canada
    Posts
    88

    Angry

    i've gotten my program to connect but now i get errors when trying to send just text back and forth through my server and client....the error is 40006 wrong protocal or connection state for the requested transaction or request.

    please respond asap

    heres the code

    client

    Option Explicit
    Dim a As String, b As String

    Private Sub cmdConnect_Click()
    On Error Resume Next
    sock.Connect txtIP, txtPort
    End Sub

    Private Sub cmdDisconnect_Click()
    sock.Close
    End Sub

    Private Sub cmdSend_Click()
    sock.SendData txtSend.Text
    End Sub


    Private Sub sock_DataArrival(ByVal bytesTotal As Long)
    sock.GetData a
    txtvChat.Text = txtvChat.Text + a
    End Sub

    server:

    Option Explicit
    Dim i As Integer, a() As String, b() As String



    Private Sub cmdSend_Click()
    SendData txtSend.Text
    End Sub

    Private Sub Form_Load()

    sock(0).LocalPort = 7659
    sock(0).Listen

    End Sub



    Private Sub sock_ConnectionRequest(index As Integer, ByVal requestID As Long)
    If index <> 0 Then
    i = i + 1
    ReDim Preserve a(i)
    ReDim Preserve b(i)
    Load sock(i)
    sock(i).Accept requestID
    End If

    End Sub

    Private Sub sock_DataArrival(index As Integer, ByVal bytesTotal As Long)
    sock(i).GetData a(i)
    txtvChat.Text = txtvChat.Text + a
    End Sub

    Sub SendData(Param As String)
    b(i) = Param
    sock(i).SendData b(i)
    End Sub


  2. #2
    Addicted Member
    Join Date
    Sep 2000
    Posts
    219

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