Results 1 to 3 of 3

Thread: Broadcasting a message using winsock, Help!

  1. #1
    New Member
    Join Date
    May 99
    Location
    Toronto, Ontario, Canada
    Posts
    7

    Post

    Hello, I've wriiten a chat program, it's fully functional but it's tough to tell if someone on the other end is there. An example would be me trying to connect to my friend each time just to see if he's there. So I want to broadcast a message out each time I click on a button and when the form first loads. Here's what I have so far:

    Dim LIP As String

    Private Sub Form_Load()
    LIP = Winsock1.LocalIP
    **Here's where I want to broadcast the message
    End Sub
    There's more to it, it's just irrelevant.
    I also have a winsock.bas which someone's created which seems to have all the Functions and constants defined Ver. 1.1 I believe, it's a port from the winsock document based on C. In it is this:

    Public Const XP1_SUPPORT_BROADCAST& = &H200&
    Public Const SIO_GET_BROADCAST_ADDRESS = (IOC_VOID Or IOC_WS2 Or 5)
    Public Const SO_BROADCAST% = &H20
    Public Const INADDR_BROADCAST& = &HFFFF

    Declare Function send% Lib "wsock32.dll" Alias "#19" (ByVal s&, ByRef buf$, ByVal buflen%, ByVal flags%)
    Declare Function sendto% Lib "wsock32.dll" Alias "#20" (ByVal s&, ByRef buf&, ByVal buflen%, ByVal flags%, ByRef toaddr As sockaddr, ByRef tolen%)

    As well as eeverything else about Winsock. I'm not quite sure how to Implement this, I'm
    very new to VB. Any and all help would be appreciated, thanks.

    P.S. If anyone would like a copy of the Winsock.bas, give me an e-mail.

  2. #2
    New Member
    Join Date
    Apr 99
    Location
    -
    Posts
    7

    Post

    Ok what do u want to know?
    1. I want to know if the person is online + the chatbox is running
    2. I want to know if the person is online

    ----
    1. All you do is let your 'check' connect to the chatbox's port (on the persons IP) and check let's say every second wether the winsock.state = sckConnected or not

    2. use ICMP (Ping) to check wether he's there in vb, u can post a reply if u want it so I can mail it 2 u

    Wax

  3. #3
    New Member
    Join Date
    May 99
    Location
    Toronto, Ontario, Canada
    Posts
    7

    Post

    Thanks, could you send that file to me? Also, is there a way to assign a fixed IP address to someone. The standard Dial-up uses a different IP each time they login so that the person has a greater chance of connecting. As well could I easily broadcast a message to everyone connected to a LAN? I can't imagine it could be that hard.

    Thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •