I've just deleted two potential posts trying to second-guess what you want, so I thought I'd just ask instead. Do you want to use UDP because you have very low latency requirements? Is it because you think it will be simpler to start with that and then move to TCP? Will the chat be application-to-application or person-to-person?
Note that you don't necessarily need a threaded or forked application to handle multiple clients for UDP or TCP.
Some background info, sorry if you know it all already.
UDP: each packet sent is standalone. There is no concept of connection. Packets can be dropped and also delivered out of order. If your server side doesn't need to do anything else, it can sit in a loop reading packets from the socket and responding to them, without any nonblocking, selecting, forking or threading.
TCP: a connection is made to a server socket which is listening on a specific port. The server accept()'s the new connection, which creates a socket for that two-way connection. Data read and written is transmitted reliably and in-order. The server needs to manage multiple sockets: the listening socket and all current connections. This can be done with threading/forking or using select (or it's OO wrapper IO::Select), without any need for non-blocking (if the server is doing nothing else).
In reply to Re: nonblocking UDP, "Hello World" level
by jbert
in thread nonblocking UDP, "Hello World" level
by Bruce32903
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |