Results 1 to 2 of 2

Thread: Winstock Control

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Location
    Dayton
    Posts
    12

    Angry

    I started writing a client/server app at my house (on a Windows 98
    Machine)...all works fine. When I brought the VB project to work and tried
    to continue programming on a Windows NT machine, the client Winsock control
    failed to connect to the server app.

    Both machine's VB was installed from the same Visual Studio 6.0 CD and both
    VBs have service pack 3 installed.

    Here are the lines of code I use for the two Winsock controls:

    Server App----------

    tcpServer.Protocol = sckTCPProtocol
    tcpServer.LocalPort = 1175
    tcpServer.Listen

    This works fine and the Winsock control state, tcpServer.state, equals
    sckListening.

    Client App-----------

    tcpClient.Protocol = sckTCPProtocol
    tcpClient.RemotePort = 1175
    tcpClient.RemoteHost = "20"
    tcpClient.Connect

    I get no error when I run this code, but when I try to send data
    (tcpClient.SendData Text1.Text), I get the Run-Time Error 4006. It talks
    about the Winsock control being in the wrong connection state to process the
    requested transaction.

    After recieving this error, I checked the state (tcpClient.State) of the
    Winsock control every few seconds after trying to connect. For the first
    minute after trying to connect, the state of the tcpClient was 6,
    sckConnecting. Then, it'd change to 9, sckError.

    So for some reason the Winsock control is never connecting to the other one.
    I also know that the server app Winsock control NEVER recieves the
    connection request.

    I go to my network settings and I have a TCP/IP Protocol installed. Do you
    think that settings on my NT are causing this problem or ... I'm clueless.
    Like I said before, the same program works fine on my Win98 machine.

    Thanks,
    Courtney


  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Try changing the client side more to something like this:
    Code:
    tcpClient.Protocol = sckTCPProtocol 
    tcpClient.Connect SrvName,1175
    And replace SrvName with either the computer name of the computer you are trying to connect to or the IP address

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