Results 1 to 2 of 2

Thread: WinSock Connection problems!

  1. #1

    Thread Starter
    Frenzied Member CyberCarsten's Avatar
    Join Date
    Sep 1999
    Location
    Aalborg Ø, Denmark
    Posts
    1,544
    I can't make a connect between to computers! The winsock state is 6...I can't make it go 7!

    This is the program, which is sending data:

    Code:
    Private Sub cmdSend_Click()
    On Error GoTo error
    Debug.Print Winsock1.State
    
    Winsock1.SendData SendData.Text
    Exit Sub
    error:
    
    MsgBox "Error!"
    
    End Sub
    
    Private Sub Form_Load()
    Winsock1.Connect "1.0.0.2"
    Debug.Print Winsock1.State
    
    End Sub
    
    Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
    Winsock1.Bind
    End Sub
    This is the program, which is recieving the data:

    Code:
    Private Sub Command1_Click()
    On Error GoTo error
    Winsock1.Bind
    Exit Sub
    error:
    MsgBox "Error!"
    
    End Sub
    
    Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
    Winsock1.Bind
    End Sub
    
    Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
    Dim Data
    Winsock1.GetData Data, vbString
    MsgBox Data
    
    End Sub
    What is wrong???
    razor
    Software Engineer Student, Aalborg University, Denmark
    http://www.cs.auc.dk

    My email at AUC: will get a new email soon
    My website: http://www.razorsoftware.net


    Windows XP Pro/ Gentoo Linux (Laptop)
    Windows XP Pro (Home PC)

  2. #2
    New Member
    Join Date
    Aug 2000
    Location
    France
    Posts
    4
    Hiya there,

    Ok... This is my first time in replying to a post so I hope I'm making this right...

    I would use the connection oriented strucutre to transmit your data.

    On the computer that is receiving the data, you should have something like :

    Code:
    Private Sub Form_Load()
         Winsock1.Listen
         Debug.Print Winsock1.State
    End Sub
    
    Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
         Winsock1.Accept requestID
    End Sub
    I dont know much about the bind method but I hope this solves the problem,

    Best regards,

    COOLHP.



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