Building a TCP Chat in Go

  Рет қаралды 50,937

package main

package main

Күн бұрын

Пікірлер: 81
@stephensumpter5311
@stephensumpter5311 4 жыл бұрын
5:17 - 6:42 I was listening without watching and I thought I was having a stroke or deja vu lol Had to go back and check that I wasn't crazy
@Michael-ri8sg
@Michael-ri8sg 4 жыл бұрын
Hahahahahha I was watching at 2x speeds sounds funny as hell
@re0xey
@re0xey 4 жыл бұрын
I think he was supposed to edit that part out but he didn't.
@popey4525
@popey4525 4 жыл бұрын
Hahahaha
@packagemain
@packagemain 4 жыл бұрын
LOL, I am really sorry for that. Yes, this had to be cut out :)
@asadawadia
@asadawadia 4 жыл бұрын
More so than the actual tutorial what stood out to me was that you write some really really clean code
@honeywu6862
@honeywu6862 Жыл бұрын
should have met your videos earlier! i'm new to Go, didn't expect how clean and elegant to implement the server in Go. It should cost much much more time dealing with Linux-C apis if i do it in C++, and not to mention the messy things with poll/select stuffs. GO for the future!!
@squ34ky
@squ34ky 3 жыл бұрын
This was fantastic! More like this, please. Thank you.
@aa-gc9wc
@aa-gc9wc 4 жыл бұрын
I need more of your tutorials, they are very high quality
@slicken
@slicken 3 жыл бұрын
cmon Alex.. miss your videos. Please dont give up on uss! make more GO videos
@acronproject
@acronproject Жыл бұрын
Thanks for this useful content Me. Pliutau
@bikhoda6508
@bikhoda6508 3 жыл бұрын
Excellent tutorial. BTW, what are the pros and cons of tcp over websokets for making a chatroom?
@dingdong2752
@dingdong2752 4 жыл бұрын
Love your content! Please come back and create more golang content,. thank you!!
@김기범-i4d
@김기범-i4d 2 жыл бұрын
Thank you very much :) You are my God
@mtdrip9523
@mtdrip9523 4 жыл бұрын
how would this approach scale if you had 10.000 clients ? i know its abit strange with a chatroom with 10.000 members but thinking if theres a smarter way of doing broadcast () than running from start to end as the last members would experience some delay if we assume ex the chat was sending an image or something larger than a text ?
@gyuyoungpark5509
@gyuyoungpark5509 2 жыл бұрын
it is the best TCP chat example!
@imagineabout4153
@imagineabout4153 2 жыл бұрын
Amazing tutoria. Just a curioisty... are the go routines getting closed after quitting?
@packagemain
@packagemain 2 ай бұрын
yes
@imagineabout4153
@imagineabout4153 2 ай бұрын
@@packagemain cool thanks
@dmitryvozniuk
@dmitryvozniuk 3 жыл бұрын
Great! Thank you man.
@MINGLI-w1h
@MINGLI-w1h Жыл бұрын
This is a great video! What are you use font, tell me please~~~ Thank you.
@jesuszunigaamador3226
@jesuszunigaamador3226 2 жыл бұрын
I don't understand how to execute it at the end. you have to download the telnet package I guess but how or where? I'm lost I'm new to GO.
@TuxGnome
@TuxGnome 4 жыл бұрын
love this your channel, if you have plans on making a course on Go (with hands on real world stuff), you def got me!
@packagemain
@packagemain 4 жыл бұрын
What are thinking of? Series of articles?
@TuxGnome
@TuxGnome 4 жыл бұрын
@@packagemain video courses, maybe start something on Udemy to build up audiences and then move to your own platform or if you already have an audience try teachable.com. Personally I couldn't find any quality videos on Go and specially the topics you cover such as this one or the previous video on how to create an API client.
@packagemain
@packagemain 4 жыл бұрын
Sounds good. Need to plan the course and what would go there
@venuarremsetty2425
@venuarremsetty2425 4 жыл бұрын
@@packagemain Firstly, I really appreciate the content you have published, it 's much needed content. Thank You. A course which is a quick refresh for a beginner and then provides all the things that enables a beginner go programmer to transition from learning basics to implementation of the concepts to Pursue as a CAREER. Most of the beginner level courses; presents concepts, examples and more examples. SO, what next? is starting a server in Go termed advanced concepts? Creating a file, opening a file, reading a file advanced concept? Deploying a simple app using Heroku advanced concept? and many more... May be a mini project of a web app from start to finish? Create blueprint for common use cases pertaining to work with files, work with databases, algorithms and etc. With focus on teaching production ready code? Following could be the end goals of your course for the student: 1. Make job ready (within an year) 2. Make easy transition from other programming language to Go But surely, there is a gap and there is a need for a course to happen.
@connor5567
@connor5567 2 жыл бұрын
Would it be possible to use a proxy library to route communications over Tor?
@packagemain
@packagemain Ай бұрын
Yes, I believe so.
@cubiccode3867
@cubiccode3867 5 ай бұрын
Great video man, thanks for the content. One thing that I think would be better is if you made a more iterative process, running and testing as you build the application.
@packagemain
@packagemain 3 ай бұрын
Thanks for the idea!
@MaximRovinsky
@MaximRovinsky 2 жыл бұрын
Крутое видео, понравилось. Спасибо Алекс
@ScalpingTradingSchoolReal
@ScalpingTradingSchoolReal 2 жыл бұрын
You are great man!!! СПАСИБО!
@soaring_dove
@soaring_dove 4 жыл бұрын
yu awesome human being, COME BACK WITH THE NEXT ONE SOON !
@iamundefinedv
@iamundefinedv 4 жыл бұрын
Great content. Keep it up.
@alfonsovargas8578
@alfonsovargas8578 Жыл бұрын
How we can add authentication for securing the connection?
@packagemain
@packagemain 2 ай бұрын
Good question. I think you can implement it yourself and ask for password first before continuing.
@giorgizazadze1337
@giorgizazadze1337 2 жыл бұрын
It doesn't work on my end :(
@shun6284
@shun6284 3 жыл бұрын
Can you make tutorials for UDP also?
@ScalpingTradingSchoolReal
@ScalpingTradingSchoolReal 2 жыл бұрын
Please make more videos for newbies!!!)))
@abiodun6897
@abiodun6897 4 жыл бұрын
Please create a course for golang for beginners ❤️
@JoseMonteverde
@JoseMonteverde 3 жыл бұрын
watching the advanced stuff sometimes helps you understand more, but only sometimes
@zeldris6218
@zeldris6218 3 жыл бұрын
Thanks a lotttt
@anjalipc8649
@anjalipc8649 4 жыл бұрын
Thank you Sir.
@rsrini7
@rsrini7 4 жыл бұрын
Thanks for good content and explanations. Please show us first demo how the chat application works and then do code, may help to catch quickly while watching the coding part.
@stokeslmao8272
@stokeslmao8272 Жыл бұрын
quality stuffs
@UAStriker
@UAStriker 4 жыл бұрын
thank you!
@vladimirm1126
@vladimirm1126 4 жыл бұрын
Great montage!
@aa-gc9wc
@aa-gc9wc 4 жыл бұрын
If you type '/join' I think the server crashes
@avechess
@avechess 3 жыл бұрын
It's right.
@packagemain
@packagemain 3 жыл бұрын
ok, I have fixed the issue. We didn't validate the args slice. Added some simple validation.
@avechess
@avechess 3 жыл бұрын
@@packagemain Thanks for editing. Are there any other questions. Can this chat simultaneously serve 1,000,000 clients? 1. How much RAM is needed for this? 2. What processor frequency is required? 3. Does this Go chat account for the number of CPU cores? There is another problem with the program. When a client completes a connection other than "/quit", the client socket remains in memory. Memory is not cleared, there is a memory leak.
@packagemain
@packagemain 3 жыл бұрын
Good question. I didn’t run tests. For a high load it’s better to use some centralized DB instead of in-memory map. So we can deploy multiple instances of this server.
@avechess
@avechess 3 жыл бұрын
@@packagemain The database introduces its own performance limits.
@ardiansyahrukua3020
@ardiansyahrukua3020 3 жыл бұрын
Awesome
@viczking8520
@viczking8520 2 жыл бұрын
thank you for your code
@hhellohhello
@hhellohhello 4 жыл бұрын
very nice
@jarriabidi1438
@jarriabidi1438 4 жыл бұрын
thanks for setting up gofmt lol
@Matt-xs1xt
@Matt-xs1xt 4 жыл бұрын
Can you run this on Windows?
@packagemain
@packagemain 4 жыл бұрын
Yes, TCP and telnet are not specific to Unix only
@avechess
@avechess 3 жыл бұрын
Thanks for the nice Go tutorial! But there is a remark. This Chat Server on Go keeps the connection of clients only in the local network stably. If the client connects from the global network, then the connection lasts for about one minute and is terminated. Tell me who knows how to avoid this. Этот чат-сервер на Go поддерживает стабильное соединение клиентов только в локальной сети. Если клиент подключается из глобальной сети, то соединение длится около одной минуты и завершается. Подскажите, кто знает, как этого избежать.
@avechess
@avechess 3 жыл бұрын
Adding. If the client periodically (for example, every 5 seconds) sends a short message, the connection is not dropped. As far as I understand it has to do with global routers. Can the server itself maintain a connection without messages from the client? Добавление. Если клиент периодически (например, каждые 5 секунд) отправляет короткое сообщение, соединение не разрывается. Насколько я понимаю, это связано с глобальными роутерами. Может ли сам сервер поддерживать соединение без сообщений от клиента?
@ricochetojosdemiel
@ricochetojosdemiel 4 жыл бұрын
Interesante
@alexandervasilenko7773
@alexandervasilenko7773 4 жыл бұрын
Rooms and members in memory? Not so good idea because of the service limitations as a whole... Probably it's the reason for such implementation - educational only. Am I right? At least all the rooms should be persisted. For example in redis (cluster). In addition it's nice to have an interface for persistent storage with the appropriate implementation(s). In addition, broadcast messaging is havy operation so it would be nice to 'go' using by some strategy pattern impl?
@packagemain
@packagemain 4 жыл бұрын
Totally agree, memory for educational purpose only, I mentioned this at the end. Calling broadcast in he background is a good idea also!
@baxiry.
@baxiry. 4 жыл бұрын
I guess there is not much difference between storing it on a map of Golang or Redis. Both are stored in RAM. Yes, redis can store on disk In case of production, a disk copy must be made I think a key/value store like Badger would be more useful.
@leerick3960
@leerick3960 3 жыл бұрын
itscool
@IDK-bg5ww
@IDK-bg5ww 3 жыл бұрын
21:54
@Michel_de_Montaigne
@Michel_de_Montaigne 27 күн бұрын
На русском нет?)
@packagemain
@packagemain 25 күн бұрын
пока что нет )
@bernardgachago1335
@bernardgachago1335 4 жыл бұрын
Great video 👍🏾
@wch1966
@wch1966 4 жыл бұрын
thank you!
How To Stream Large Files Over TCP In Golang
17:50
Anthony GG
Рет қаралды 38 М.
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
How To Build A Custom TCP Server In Golang!?
19:32
Anthony GG
Рет қаралды 34 М.
КАК УСТРОЕН TCP/IP?
31:32
Alek OS
Рет қаралды 269 М.
Beginners Should Think Differently When Writing Golang
11:35
Anthony GG
Рет қаралды 133 М.
Malware Development: Processes, Threads, and Handles
31:29
Advanced Golang: Channels, Context and Interfaces Explained
22:17
Code With Ryan
Рет қаралды 129 М.
Go Pointers: When & How To Use Them Efficiently
14:09
Anthony GG
Рет қаралды 91 М.
The Return of Procedural Programming - Richard Feldman
52:53
ChariotSolutions
Рет қаралды 62 М.
This Will Make Everyone Understand Golang Interfaces
21:03
Anthony GG
Рет қаралды 58 М.
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН