Results 1 to 2 of 2

Thread: what's wrong with this code? - winsock

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 1999
    Location
    Sweden
    Posts
    7

    Post

    I'm making a tiny little program for chatting over a network (almost like winpopup) but it doesnt work...

    Code:
    Function Connect(sendIP As String) As Boolean
    
        Form1.Winsock1.Close
        Form1.Winsock2.RemoteHost = sendIP
        Form1.Winsock2.RemotePort = 1066
        Form1.Winsock2.Connect
        Connect = True
    
    End Function
    
    private sub cmdSend_Click()
    
    Dim D As Boolean
    D = Connect(txtIP)
    If D = False Then
        Exit Sub
    End If
    
    If Form1.Winsock1.State = 0 Then
        Form1.Winsock1.Listen
    End If
    
    If Form1.Winsock2.State = sckConnected Then
        Form1.Winsock2.SendData txtMess
        Form1.Winsock2.Close
    Else
        MsgBox "could not send."
        Form1.Winsock2.Close
    End If
    
    end sub
    What's wrong with this? when i run the program it says "could not send" because the state of the winsock is "Connecting" not "Connected" as i want it to be...



  2. #2
    Addicted Member
    Join Date
    Jul 1999
    Posts
    219

    Post

    ok try this
    where you put form1.winsock1.connect
    what are you connecting to??
    so you got to do this

    call form1.winsock1.connect("ip here",port here)

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