0

When I search for Python and Chat I always read TCP/ IP. They use Sockets to update the Console with new incoming data. But I don't find a way to refresh the console when I use an online MySql database with password etc..

Example:

I want to have a simple Console Chat, where you can write with somebody, and the incoming Text refreshes automatically when somebody writes something.

Or with Threads:

When I load the Text (like in a chat) from the Database and print it out it always prints the text again and again.

Julien Marrec
  • 11,605
  • 4
  • 46
  • 63
  • Why should the database make any difference to how to refresh the screen? – Daniel Roseman Jan 02 '17 at 11:26
  • Possible duplicate of [Use input() and print() at the same time (like in a chat)](http://stackoverflow.com/questions/12010446/use-input-and-print-at-the-same-time-like-in-a-chat) – Uncle Dino Jan 02 '17 at 11:51
  • Possible answer: http://stackoverflow.com/questions/12010446/use-input-and-print-at-the-same-time-like-in-a-chat You need 2 threads, one for sending and one for receiving. – Uncle Dino Jan 02 '17 at 11:52
  • 2 Threads. And then i can read from the database permanenttly with a While loop or do you have a little example for me, that would be soooo cool :D – user7364986 Jan 02 '17 at 12:02

0 Answers0