[xSocket-develop] Some explanation of non-blocking I/O and multiplex
Status: Inactive
Brought to you by:
grro
|
From: Kasper G. <ka...@un...> - 2010-04-26 20:34:58
|
Hi,
I am playing with networking sockets for the very first time, and
while playing around with Java networking in java.net.Socket I was
able to build a small socket server that didn't scale so much because
i built it with a thread for each client.
I have now switched to xScockets, and I have questions about a couple
of words that you are using for explaining your framework.
Non-blocking IO:
Wikipedia writes: "Asynchronous I/O, or non-blocking I/O, is a form of
input/output processing that permits other processing to continue
before the transmission has finished.". Consider the following code:
ArrayList<INonBlockingConnection> clients = new
ArrayList<INonBlockingConnection>();
public void sendToClients(String msg)
{
for(INonBlockingConnection client : this.clients)
{
client.write(msg);
}
}
Does that mean that a client that is slow to recieve the msg, would
not block for the next client in the list? And does it mean that
client.write(msg) would terminate the same moment that it is run?
My next question is what multiplexing is, and what it is useful for?
Which types of applications?
Thanks,
Have a fantastic day :)
--
Kasper Grubbe
Computer Science AP
|