PDA

Click to See Complete Forum and Search --> : sockets & threads


Chigori
Sep 18th, 2002, 06:22 PM
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.

Nigh™aŽe
Sep 19th, 2002, 04:26 AM
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