Re: listen (sock, back)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Look at demo/chat_server.ex ... It is a multi-user chat server that accepts any number of connections all while maintaining communication with other connected clients. Basically, the main loop uses select to detect new incoming connections, incoming messages or clients that have disconnected. When a new connection exists, it calls accept and let's the other chatters know of the new person who just joined. When a new message comes in, the message is then sent to all connected clients. When a client disconnects, all remaining clients are sent a disconnect notice.

You can use chat_client.ex to communicate with the server. The idea was not to make a chat system but to show off select.

Maybe this is what you are looking for?

Jeremy

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu