Advanced TCP Chat Room in Python

preview_player
Показать описание
After long waiting it is finally here. The sequel to the first TCP chat tutorial in Python. In today's video we will add the kicking and banning features, as well as an admin role.

◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
📚 Programming Books & Merch 📚

🌐 Social Media & Contact 🌐

🖥️ My Coding Setup 🖥️

Рекомендации по теме
Комментарии
Автор

you deserve more subcribers so underrated :(

kxkl_
Автор

This is great. Thank you for making this video. It was very much needed and you are the only youtber who did this.

abhishektiwari
Автор

I just discovered your channel. Your stuff is S tier super simple and up-to-date

alialtan
Автор

This is absolutely a brilliant piece of work. Thank you so much. Keep them coming !!

sreeramvishal
Автор

I’m always watching well. Thank you for posting a good video.
I couldn't speak English well so I used a translator

mrlee
Автор

Hi, I have one big gripe with this tutorial:

TCP is a stream protocol, and your code simply disregards any and all possibilities that one single call to recv() could have potentially more than one send() of the remote side, or could potentially even split up a single send() of the remote side. For example, what if you send 1025 bytes? that last byte would be contained in the *next* recv(). And recv(1024) doesn't guarantee that all bytes that where send are also received in a single call. It could be anywhere between 1 and 1024 bytes (empty byte string is only returned on EOF).

There are zero guarantees that every send() of the remote side is going to match every recv() on the local side.

You have to account for that by implementing a proper protocol, for example: have every command be terminated by a line break or similar (IRC-like), buffer the bytes on the other side when receiving, and split by the line break when it appears.


Otherwise it's a good basic introduction. UDP would probably have been more appropriate for a packet based protocol - though it would be not as reliable as TCP.

SaniSensei
Автор

It's awesome can you add cryptography in it ?

shakeyshakeygamers
Автор

Hey, love the app. I liked to play about with it and managed to get a few machines talking together. Even got my phone joining in with the client running on Pythonista. I did get errors though when getting kicked and trying to implement a quit chat function. I think its due to the fact that the threads get left hanging on so I added



to the kick_user(name) function in server.py. I then had to add:

elif message == 'KICKED':
print('You were kicked by admin!')
client.close()
stop_thread = True
continue

I wrapped the write functions contents in a try, except and had the except: client.close() then return, seems ok now. I know this gives a bit of control to the client as they can manipulate the client.py but this is only an introduction into the chat app world and also fun to hack around with.

Thanks NeuralNine keep up the great work.

iainmitchell
Автор

Awesome video man, this code alone has so much potential!

PhonkElement
Автор

Time stamps and / or source code is really necessary for debugging, otherwise we are wasting a lot of time when things don't go as planned...

yestinlamptey
Автор

You are underrated😤😤😤😤... Such an amazing channel

MuhammadWaseem-ckgn
Автор

It would be so amazing to see how to actually move this out of local network, because this seems almost impossible with raw sockets

markmark
Автор

Incredibly useful, but something that would make this truly invaluable to me is if it wasnt just LAN based but took things forward by making this WAN using port-forwarding

soupnoodles
Автор

Because the commands are on the user side, you can change == admin to != admin and use the kick and ban commands.

sepehrdehghan
Автор

It would be great if you could add this for the GUI chat!
PS: great channel!

fallcrim
Автор

Hi NeuralNine, great tutorial! I've got both client and server running except when login as admin and when type something the program just quit and server indicate admin has left the chat. couldn't figure it out.

jimmykan
Автор

Hi, how are you?

very helpful video and thank you for making it!

I was just wondering if you could do a video of the same chat room but adding DMS and color changing for the nickname and also some ipbans so that people cannot join the same chat room again (like even more advanced chat room :))

thank you so much

-itay

itayzaliasnik
Автор

hello! thanks for your code!
if smb have problem with message sending (your message doesn't send and you falling down to infity) check how you write: startswith()

polina_sayfudinova
Автор

Can you please make a video on how you put your ideas into code? How do you understand documentation etc?

hackerexploit
Автор

Want next video related to this topic with extra features...❤️❤️

darpankroo