Results 1 to 1 of 1

Thread: winsock broadcast client to server

  1. #1

    Thread Starter
    Addicted Member morkie's Avatar
    Join Date
    Jan 2009
    Location
    P4
    Posts
    202

    winsock broadcast client to server

    I found a thread about "VB6 - Winsock, Auto find server using UDP Broadcast (LAN ONLY)" post by CVMichael and reply of Aan2702 his post and code and sample attached file i test it and that's what i want when any another 2 PC running U'r winsock sever application. All winsock server
    send(Broadcast) their IP addres to PC whose Running Winsock Client(Bind).

    what if all running winsock server and their multiple winsock client will send(broadcast) their ip address to PC whose running as server and putting it into all listbox...can you help with that, that's what i want in your code in CVmichael thread is server send(broadcast)their ip address whos running as a client...

    And me as a server....

    Thanks.....

    Here's the file of they use

    From Server:

    Code:
    Private Sub Command1_Click()
           On Error Resume Next
            For x = 420 To 440
                Winsock1.Close
                Winsock1.RemoteHost = "255.255.255.255"
                Winsock1.RemotePort = x
                Winsock1.SendData Winsock1.LocalIP
            Next
            Timer1.Enabled = True
        
    End Sub
    
    Private Sub Form_Load()
    Winsock1.Close
    Me.Caption = "BoardCast Server"
    End Sub
    
    Private Sub Timer1_Timer()
        Command1_Click
    End Sub
    From Client:

    Code:
    Dim IP As Integer
    Private Sub Form_Load()
    Me.Caption = "BoardCast Client"
    IP = 420
    On Error GoTo errIP
    
    Winsock1.Bind IP
    Exit Sub
    errIP:
    IPIncrease
    Exit Sub
    End Sub
    
    Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
    On Error GoTo errIP
        Dim strData As String
        Winsock1.GetData strData
        Text1.Text = strData
        Exit Sub
    errIP:
    IPIncrease
    End Sub
    
    Sub IPIncrease()
        On Error GoTo errIP
        IP = IP + 1
        Winsock1.Close
        Winsock1.Bind IP
        Exit Sub
    errIP:
        IPIncrease
    
    End Sub
    Attached Files Attached Files
    Last edited by morkie; Sep 10th, 2009 at 07:27 PM.

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