Results 1 to 7 of 7

Thread: [RESOLVED] Braodcasting message over Lan usng winsock (vb6)

  1. #1

    Thread Starter
    Fanatic Member coolcurrent4u's Avatar
    Join Date
    Apr 2008
    Location
    *****
    Posts
    993

    Resolved [RESOLVED] Braodcasting message over Lan usng winsock (vb6)

    Good day guys,

    am trying to broadcast message too server from client using port rang technique on lan

    the server receives one client and connect them. but when another tries to connect, it says address in use.

    thanks.
    Programming is all about good logic. Spend more time here


    (Generate pronounceable password) (Generate random number c#) (Filter array with another array)

  2. #2
    Member
    Join Date
    Mar 2006
    Posts
    46

    Re: Braodcasting message over Lan usng winsock (vb6)

    If you are using TCP and not using an control array then you can only have one connection at a time. Now if you UDP, I'm not to sure.
    Please try to provide some more info. Ports numbers, Protocol?

  3. #3

    Thread Starter
    Fanatic Member coolcurrent4u's Avatar
    Join Date
    Apr 2008
    Location
    *****
    Posts
    993

    Re: Braodcasting message over Lan usng winsock (vb6)

    am using winsock tcp but using udp to do the broadcast. i used cvmicheal work but its only one pc to i server.

    i tried using multiple connection with no success
    Programming is all about good logic. Spend more time here


    (Generate pronounceable password) (Generate random number c#) (Filter array with another array)

  4. #4
    Member
    Join Date
    Mar 2006
    Posts
    46

    Re: Braodcasting message over Lan usng winsock (vb6)

    So after finding the example you used, here is your problem...

    The example was written to accept one connection at a time using TCP. So, using that only two people can chat at a time. What you need to do to accept more connections is use a control array. It is a little more work but you can do it.

  5. #5

    Thread Starter
    Fanatic Member coolcurrent4u's Avatar
    Join Date
    Apr 2008
    Location
    *****
    Posts
    993

    Re: Braodcasting message over Lan usng winsock (vb6)

    if it is accepting multiple connections, i can do that but its Braodcasting message over Lan usng winsock. The server dosent know the client ip, so is the client .

    the client should broadcast their ip and the server finds them and send them his own ip
    Programming is all about good logic. Spend more time here


    (Generate pronounceable password) (Generate random number c#) (Filter array with another array)

  6. #6
    Member
    Join Date
    Mar 2006
    Posts
    46

    Re: Braodcasting message over Lan usng winsock (vb6)

    How many people to you intend to use this program.

    Here is a problem with your current setup.
    Only two people can really talk to each other. If you could get more connections, that means that one person will be connected to two people
    i.e.
    Bob is talking to Alice. Bill connects to Bob's "server".
    So now anything that bob says both Alice and Bill will see what Bob wrote.
    However Alice can't talk with Bill, and Bill can't talk with Alice.

    If you plan or need to have more than two people you're going to have to make a real message server. Where when one person sends a message, the server receives the message and then sends it to everyone connected to the server.

  7. #7

    Thread Starter
    Fanatic Member coolcurrent4u's Avatar
    Join Date
    Apr 2008
    Location
    *****
    Posts
    993

    Re: Braodcasting message over Lan usng winsock (vb6)

    finally i got it to work!!

    i placed three winsock controls on the server, 1 for TCP which is a socket array and two other udp . 1 to listen (udplisten), and the other to reply (udpreply).

    The one that listens just listens for client ip request. as i said before. the client should find the server not the server finding the clients. this will reduce server workload.

    the client scan port range of which the server must listen on, that is the udplisten socket

    the client constantly send message to all the ports within fraction of a second until it gets a reply from the server.

    if they get disconnected, they do the same thing again

    if you need my code sample, please say so!!

    thanks for all who contributed.
    Last edited by coolcurrent4u; Sep 4th, 2009 at 05:58 AM.
    Programming is all about good logic. Spend more time here


    (Generate pronounceable password) (Generate random number c#) (Filter array with another array)

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