0

Im making a chat project like Whatsapp and In the instruction they told me to build the client with the select.select method. Can anyone explain me how to use this method in the client? (I know how to use it in the server but didnt succeed in the client)

Tomer
  • 11
  • 3
  • 1
    You use it the same way as a server, but don't put the server socket in the "readable" list to process accepts. If you show some actual code, we can determine what "didnt succeed" means. – Mark Tolonen Aug 28 '20 at 16:08
  • @MarkTolonen `while True: rlist, wlist, xlist = select.select([client_socket], [], []) if len(rlist) != 0: print client_socket.recv(1024)` – Tomer Aug 28 '20 at 22:28
  • Edit your question with a [mcve]. Include error messages and desired result. Code is a mess in comments. – Mark Tolonen Aug 28 '20 at 23:38
  • Ummm... You probably don't want to use raw TCP sockets for chat apps. Instead you should use [Websockets](https://en.wikipedia.org/wiki/WebSocket). See why [here](https://stackoverflow.com/questions/2681267/what-is-the-fundamental-difference-between-websockets-and-pure-tcp). – Take-Some-Bytes Aug 29 '20 at 04:49
  • @Take-Some-Bytes I cant use websockets its not allowed in the mission :( – Tomer Aug 29 '20 at 09:12

0 Answers0