Results 1 to 2 of 2

Thread: sockets & threads

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2002
    Location
    Moncton
    Posts
    8

    sockets & threads

    I'm trying to write a multithreaded application where 1 thread monitors a queue and send the messages in the queue (if there are any) and 1 thread looks for incoming messages and handles them... The first part I have done and is working, the second part (incoming messages) I can't get to work.

    Is there a sockets function that gets triggered or wait for incoming data? If not, do I just have to put a read in an endless loop or so?

    Thanks,
    Chig.
    VB Addict

  2. #2
    Addicted Member Nigh™a®e's Avatar
    Join Date
    Feb 2002
    Location
    Belgium
    Posts
    175
    You have to make your own procedure to check if there is incomming data.

    I'm also creating a kind of messenger program and i'm using a timer.
    First i use the Pending to check incomming connections.
    Then i check incomming data for each connection.

    Each active connection has an Sockets.Socket object to communicate with the clients.

    After that is check for incomming data.

    If Socket.GetStream.DataAvailable = True Then
    While Socket.GetStream.DataAvailable
    Socket.GetStream.Read(Buffer,0,Buffer.lenght)
    End While
    End if

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