Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Oct 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    vb socket programming quick question

    I searched the forums and didnt find anything so heres my question...

    I have made a chat client in vb using sockets but the problem its only allowing one connection at a time.... i tried making an array to store the connected ips but that didnt work.

    Is the a special sock.<function> for allowing mutilple connections

    Thanks!

  • #2
    Regular Coder
    Join Date
    May 2004
    Location
    New Hampshire, America
    Posts
    246
    Thanks
    0
    Thanked 2 Times in 2 Posts
    I have had the exact same question for a while. I write a chat program but couldn't figure it out, then tried allocating winsock objects in an array, but found it to difficult to manage. My final solution was to give up. Just joking! So far though, haven't had much luck. You could use the Winsock array, but I don't know how to write individual handlers for operations like DataArrival. I was wondering if there was a way to dynamically declare functions and subs and objects in vb, because this would solve the problem. If it's possible, the code might look something like:
    Private Sub Winsock(i)_DataArrival(bytes as integer)
    ...
    ...
    End sub

    I don't think this is legal coding though! I hope this helped somewhat. If not, maybe you should consider switching it over to C++, in which case all your problems are solved!

  • #3
    Regular Coder
    Join Date
    Nov 2004
    Location
    USA
    Posts
    123
    Thanks
    0
    Thanked 0 Times in 0 Posts
    what are you trying to connect to? is it on a network or accoss th web? if it is across the net work set one computer on the network just for handeling the connectoins in a diffent socket. Have a server socket and a client socket. server for listing for new connections on ports and the client for chating on the ports

  • #4
    Regular Coder
    Join Date
    May 2004
    Location
    New Hampshire, America
    Posts
    246
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by dw5304
    what are you trying to connect to? is it on a network or accoss th web? if it is across the net work set one computer on the network just for handeling the connectoins in a diffent socket. Have a server socket and a client socket. server for listing for new connections on ports and the client for chating on the ports
    First off, with vb you can use the web or network with a TCP/IP Winsock object, which is one nice thing about it. You can also use the same socket to receive and send messages, so a server and client socket is pointless. You are only allowed one connection per socket, which is the main problem.

  • #5
    Regular Coder
    Join Date
    Nov 2004
    Location
    USA
    Posts
    123
    Thanks
    0
    Thanked 0 Times in 0 Posts
    not 100% true i have net network over here haveing roughly 400 computer runing on my chat client all connecting on one port: 6653 it handles it varry well.

  • #6
    Regular Coder
    Join Date
    Oct 2004
    Posts
    230
    Thanks
    0
    Thanked 0 Times in 0 Posts
    port is completely different than socket.


  •  

    Posting Permissions

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