This man has a video on how to make a discord ui as well as how to create a chat app.... he essentially just gave the power of remaking discord to everyone
Great Vid, very instructional. One thing I would like to add, in the Packet Builder under the Write Message module, when using VS 17.4, you have to add 1 line to it, where you actually create a buffer and get a buffer length to get it to work properly. Well, at least for me this was the case, it may be a .Net version discrepancy also since 5.0 is no longer supported any more. public void WriteMessage(string msg) { byte[] buff = BitConverter.GetBytes(msg.Length); _ms.Write(buff, 0, buff.Length);
Thanks for all your videos! I mainly code via scripting for work (data analysis). So it's a lot of just taking random data formats in, manipulating them, and outputting them in a format for some other program. I've always wanted to give a shot at developing my own desktop apps and your videos made everything just make sense, especially with how MVVM works in the real world. Even though I mostly only know Python/R I was able to quickly pick up C#/XAML and have been able to make a good looking and functional websocket app for a streamer friend to help automate their stream chats!
Please continue to make videos like witch you create small wpf apps with their cool design. I hope you make a wpf app with database like SQlite and made a customer like app where you add/modify/delete/filter into database.That will be very helpful for me and a lot of people as well.
1) It`s literally magnificent! Thank you so much, keep making such videos plz! 2) How did you set-up the color theme in your visual studio, look`s great! 3) Can this chat communicate over the Internet (computers are in different networks)? Thanks for video, one more time!
It should be able to, 1 person can have the server, just make sure it uses your outside IP address, and unused port. Everyone else would need the client, and to have the correct IP address and port number to connect properly. And if the server is on a home network, you will need to make sure port forwarding for the selected port is forwarding to the correct internal IP address.
How to display multiple chat windows? My code is the same as in the video but it only displays 1 mainwindow window? Please help me answer. Please. Thanks
bro when clicked on Connect button => Server App Closed (crashed). also when i created project - i cant find .net 5 and last for me is 4.8.1 - can you think where is problem (my coding from 0 to 8 min of video)
in visual stidio you can rightclick a project and click debug then click start new instance and it will put another instance in debug mode instead if just openning an exe
Maybe it's too late to question, but it seems to be a very simple text message app. What do you do when client wants to send different kinds of messages. Let's say he's sending a video to server. It's going to take a while until all bytes are sent to server and while sending the video he's going to send a text message as well. So, how your server is going to recognize what messages it's reading? Because it was busy reading the video data. Or maybe you must use another TcpClient for such scenarios?
Good question! And compression the video is always a good idea, and another possibility is to create a thread per client and have ti run all of it's own work.
Great video thanks, this will really help with learning C# ! p.s. at 31.06 with i got a error CS0052: public PacketReader PacketReader; i fixed it by making the: public class Server to an internal class server I don't know if anyone else got this problem or im just stupid, but if anyone got troubles with it you can try this.
Hello, I have a problem at 19:25. MemoryStream.Write need 3 parameter (byte[] buffer, int offset, int count). But in the video you only pass one parameter. Is there a solution for this?
If you are using .NET 4.x framework, you can do the following: public void WriteMessage(string msg) { byte[] buff = BitConverter.GetBytes(msg.Length); _ms.Write(buff, 0, buff.Length);
how can we make the clients are able to send a private message, i.e. they are able to select one of the users in the chat room in some way and only the designated user will receive the message?
Good question! You could either set up the project to debug that way, or head into the bin folder and run another instance that way by running the executable. :-)
Good question! Overly complicated for creating something so simple, as well as the fact that it just adds a bunch of unecessary abstraction while at the same time limiting the development experience, the only time I would actually use SignalR would be if I wanted to live update something in a web application :-)
Hey, is there a way for two computers on the same wifi to connect to the same server? I tried to change the IP address to my own but that doesn't work.
I finished writing out all of the code as in the video, everything works except for the messaging - it doesn't get sent through to the console or the program
Hi, thank you so much for this tutorial it has really helped me. However, I have a bug I cannot seem to fix. Whenever I send a packet, three characters of the string are omitted. My packet Reader and packet Builder classes are exactly the same as yours, as is most of the code I am using The issue gets solved when I just add three to the message length but I want a more solid solution. Thank you
This tutorial is very great! But I'm stuck on a 21:00 part... I receive an error "There is no argument given that corresponds to the required formal parameter 'offset' of 'MemoryStream.Write(byte[], int, int)" Did everything as in the tutorial but still getting this message.... It is in PacketBuilder on ChatClient it shows me an error on : _ms.Write(BitConverter.GetBytes(msgLength)); _ms.Write(Encoding.ASCII.GetBytes(msg)); on "Write" sentence.. Could you help me please why do I receive this error?
I should have looked at this sooner, I figured it out and posted it in my comment above, but I will put it here again. Great Vid, very instructional. One thing I would like to add, in the Packet Builder under the Write Message module, when using VS 17.4, you have to add 1 line to it, where you actually create a buffer and get a buffer length to get it to work properly. Well, at least for me this was the case, it may be a .Net version discrepancy also since 5.0 is no longer supported any more. public void WriteMessage(string msg) { byte[] buff = BitConverter.GetBytes(msg.Length); _ms.Write(buff, 0, buff.Length);
I did at first, but found I was missing the namespaces for them, the RelayCommand class needs to have ' using System.Windows.Input; ' namespace, and then the _listener needs to have the ' using System.Net.Sockets; ' namespace. Start there, and see if it helps you progress with the program.
I have error ; System.Windows.Markup.XamlParseException "Adding a value to a collection of type 'System.Windows.Controls.ItemCollection' returned an exception.' Line number '35' and line position '18'.' Inner Exception InvalidOperationException: The operation is not valid when using ItemsSource. use ItemsControl.ItemsSource instead to access and modify items. Can you help please.
i'm just stuck in that moment 8:05 if in video it at least showed error, in my situation it looks like it's not working at all because i have no error, no "connected" text (i decided to follow video a bit further cause i thought maybe program is working but it's not) it seems like a binding is not working, do i have to maybe install something on my visual or something else i simply have no clue how to make it work correctly
Hey I want some help I am currently stuck at 20mins in this video. I tried recreation this wpf but im have a problem with the WriteString function. Error code CS7036
Not sure if anyone replied to you, but if they haven't, this is what I found. If you are using .NET 4.x framework, you can do the following: public void WriteMessage(string msg) { byte[] buff = BitConverter.GetBytes(msg.Length); _ms.Write(buff, 0, buff.Length);
@@marslmaoo It would involve switching from the framework to .net core. I just remade the project from scratch. I can imagine there is a way to switch though.
@@marslmaoo If you are using .NET 4.x framework, you can do the following: public void WriteMessage(string msg) { byte[] buff = BitConverter.GetBytes(msg.Length); _ms.Write(buff, 0, buff.Length);
Hi. Firstly. Thank you for the awesome tutorial. I love it!! I have a question. So we are doing this as a group project and when we try to connect together but we cannot chat or the server does not display the user joined. We are using different machines. Please tell me how we can solve that issue. Thanks
two methods ahed. if you create another window you can do new window().show() ; and it will create another window non blocking way and then you can do this.close(); and it will shut down the current window. another option is to set both views as user control and bind it to content control and change it in code. change will happend after validation in code and if you ise hosting you may even inject iy as a navigation service
This man has a video on how to make a discord ui as well as how to create a chat app.... he essentially just gave the power of remaking discord to everyone
You know it! :-)
As an experienced Java developer, I love these video tutorials that can take me into new languages quickly and efficiently.
The programming gods have blessed us brethren!
amazing, modern c# networking content seems to be lacking, this is a nice breath of fresh air
I'm glad you found it useful! :-)
Thank you so much. Your video helped a lot with my course project. I wouldn't have figured it out without you.
I'm so glad you found this useful!
I absolutely love these videos. Please keep doing stuff like this, just watching you do stuff like this is helping me pick up better habits :D
That makes me so happy to hear! And More videos are coming your way! :-)
I swear my computer listens to my conversations and recommends this video and I aint mad at all!
Hahaha heck yeah! :D
For everyone who doesn't wanna write out the code at 6:25 here you go:
namespace ChatClient.MVM.Core
{
class RelayCommand : ICommand
{
private Action execute;
private Func canExecute;
public event EventHandler CanExecuteChanged
{
add { CommandManager.RequerySuggested += value; }
remove { CommandManager.RequerySuggested -= value; }
}
public RelayCommand(Action execute, Func canExecute = null)
{
this.execute = execute;
this.canExecute = canExecute;
}
public bool CanExecute(object parameter)
{
return this.canExecute == null || this.canExecute(parameter);
}
public void Execute(object parameter)
{
this.execute(parameter);
}
}
}
i have 3 errors in this code idk why i did exactly same with video
my errors are those
ICommand
CommandManager
CommandManager
can you help me
@@kaanderin8382 Sounds like you need to add the namespace ' using System.Windows.Input; ' at the top. All 3 of those errors are in that namespace.
@@drewcumpton1232 thank you man
Where is the Icommadns interface file?
@@hubertromario4874 using System.Windows.Input
Great Vid, very instructional. One thing I would like to add, in the Packet Builder under the Write Message module, when using VS 17.4, you have to add 1 line to it, where you actually create a buffer and get a buffer length to get it to work properly. Well, at least for me this was the case, it may be a .Net version discrepancy also since 5.0 is no longer supported any more.
public void WriteMessage(string msg)
{
byte[] buff = BitConverter.GetBytes(msg.Length);
_ms.Write(buff, 0, buff.Length);
You saved my programming class test, thank you so much, cant wait to see more of your videos I also learned so many new things :)
Thanks for all your videos! I mainly code via scripting for work (data analysis). So it's a lot of just taking random data formats in, manipulating them, and outputting them in a format for some other program. I've always wanted to give a shot at developing my own desktop apps and your videos made everything just make sense, especially with how MVVM works in the real world. Even though I mostly only know Python/R I was able to quickly pick up C#/XAML and have been able to make a good looking and functional websocket app for a streamer friend to help automate their stream chats!
Please continue to make videos like witch you create small wpf apps with their cool design. I hope you make a wpf app with database like SQlite and made a customer like app where you add/modify/delete/filter into database.That will be very helpful for me and a lot of people as well.
More on the way! :-)
This is amazing man. Thank you :) Definetily going to use this in my course project :)
That's awesome! :-)
Which course did you do
@@musclewii4641 in my uni year 1
Ok
Which exam board if you don’t mind me asking
1) It`s literally magnificent! Thank you so much, keep making such videos plz!
2) How did you set-up the color theme in your visual studio, look`s great!
3) Can this chat communicate over the Internet (computers are in different networks)?
Thanks for video, one more time!
It should be able to, 1 person can have the server, just make sure it uses your outside IP address, and unused port. Everyone else would need the client, and to have the correct IP address and port number to connect properly. And if the server is on a home network, you will need to make sure port forwarding for the selected port is forwarding to the correct internal IP address.
How to display multiple chat windows? My code is the same as in the video but it only displays 1 mainwindow window? Please help me answer. Please. Thanks
Better than my lectures! xD
xD
bro when clicked on Connect button => Server App Closed (crashed). also when i created project - i cant find .net 5 and last for me is 4.8.1 - can you think where is problem (my coding from 0 to 8 min of video)
Brilliant ^-^ Would love to see how to make a custom "server" for a group of people to join.
This is one of the greatest tutorials ever, as a python developer that was the best tutorial on C#, sockets, and MVVC
thats so cool 😎
Sir don’t you plan make full tutorial for C# form Beginning to advanced 🙏
Thanks for the great tutorial mate☺️
Senpai noticed me
Thai student has been noticed!
I love your videos they are nice ideas to work on👌🏻💙
Thank you! :-)
Hello, how did you create two instances of the MainWindow at around 38:25?
Good question! I opened up the bin folder and started the .exe from there :-)
in visual stidio you can rightclick a project and click debug then click start new instance and it will put another instance in debug mode instead if just openning an exe
Maybe it's too late to question, but it seems to be a very simple text message app. What do you do when client wants to send different kinds of messages. Let's say he's sending a video to server. It's going to take a while until all bytes are sent to server and while sending the video he's going to send a text message as well. So, how your server is going to recognize what messages it's reading? Because it was busy reading the video data. Or maybe you must use another TcpClient for such scenarios?
Good question!
And compression the video is always a good idea, and another possibility is to create a thread per client and have ti run all of it's own work.
Maybe a follow up video with sending something like a message object with attachments, and to cache them on the client with the message history?
Good idea! :-)
Great video thanks, this will really help with learning C# !
p.s.
at 31.06 with i got a error CS0052:
public PacketReader PacketReader;
i fixed it by making the:
public class Server
to an
internal class server
I don't know if anyone else got this problem or im just stupid, but if anyone got troubles with it you can try this.
the best one bro thanks a lot
You're most welcome :-)
Hello, I have a problem at 19:25. MemoryStream.Write need 3 parameter (byte[] buffer, int offset, int count). But in the video you only pass one parameter. Is there a solution for this?
Make sure that you are using .NET 5 or 6 (Core) and not .NET 4.X Framework.
If you are using .NET 4.x framework, you can do the following:
public void WriteMessage(string msg)
{
byte[] buff = BitConverter.GetBytes(msg.Length);
_ms.Write(buff, 0, buff.Length);
how can we make the clients are able to send a private message, i.e. they are able to select one of the users in the chat room in some way and only the designated user will receive the message?
Could you explain to me what the methods of the RelayCommand do? Just to understand it instead of just copying it?
its kindda boiler code , so you have to mention it for the xaml and code to interact properly.
What were the usings for the RelayCommand class? You didn't show them in the video.
How are you creating multiple instances of the running project?
Good question! You could either set up the project to debug that way, or head into the bin folder and run another instance that way by running the executable. :-)
Thank you so much
You're most welcome!
Hey, great video overall but
how do you not get errors for ICommand and CommandManager?
I got those errors too
add "using System.Windows.Input;" to the top
@@Xsnipe u jus saved me bruv thank you
Great work, just a question, why you didn't use signalR ( or for learning purpose ) ?
Good question! Overly complicated for creating something so simple, as well as the fact that it just adds a bunch of unecessary abstraction while at the same time limiting the development experience, the only time I would actually use SignalR would be if I wanted to live update something in a web application :-)
@@_buffer you got a point, even if i disagree
@@ousstechfr5107 To each their own, whatever floats your boat and works for the project! :-)
Hey, is there a way for two computers on the same wifi to connect to the same server? I tried to change the IP address to my own but that doesn't work.
Should work just fine, feel free to hop on the Discord server and send me a message and I'll happily look into it! :-)
did you find out, cause i cant either
maybe a video on creating an animated wpf application?
That's actually on my list of video ideas! :D
As of 27:00 the username can only be 4 characters in length, otherwise the server is forcfully shut down. I hope you fix this further in the video.
small bug at WriteMessage func in PacketBuilder class, ms.Write(Encoding.ASCII.GetBytes(msg), 0, msg.Length); (not buff.Length)
I finished writing out all of the code as in the video, everything works except for the messaging - it doesn't get sent through to the console or the program
Hey so are you able to combine the UI video with this one?
How to display the multiple windows? Pls teach me i need this program 🙏🏻
Feelf ree to join the Discord and we can discuss it further :-)
Hi, thank you so much for this tutorial it has really helped me.
However, I have a bug I cannot seem to fix. Whenever I send a packet, three characters of the string are omitted. My packet Reader and packet Builder classes are exactly the same as yours, as is most of the code I am using
The issue gets solved when I just add three to the message length but I want a more solid solution. Thank you
Hi! I'm glad you found it useful, it would be much easier to assist you on Discord :-)
@@_buffer thank you for responding, I found out that the issue was because I called the wrong function 😂😂
This tutorial is very great! But I'm stuck on a 21:00 part... I receive an error "There is no argument given that corresponds to the required formal parameter 'offset' of 'MemoryStream.Write(byte[], int, int)"
Did everything as in the tutorial but still getting this message....
It is in PacketBuilder on ChatClient
it shows me an error on :
_ms.Write(BitConverter.GetBytes(msgLength));
_ms.Write(Encoding.ASCII.GetBytes(msg));
on "Write" sentence.. Could you help me please why do I receive this error?
I have the same problem. Did you fix it?
I should have looked at this sooner, I figured it out and posted it in my comment above, but I will put it here again.
Great Vid, very instructional. One thing I would like to add, in the Packet Builder under the Write Message module, when using VS 17.4, you have to add 1 line to it, where you actually create a buffer and get a buffer length to get it to work properly. Well, at least for me this was the case, it may be a .Net version discrepancy also since 5.0 is no longer supported any more.
public void WriteMessage(string msg)
{
byte[] buff = BitConverter.GetBytes(msg.Length);
_ms.Write(buff, 0, buff.Length);
@@lazar3517 See response above, hope this helps.
I am getting many errors in "RelayCommand" class, also in chatserver on "_listener". Did anyonle else face the same problem?
I did at first, but found I was missing the namespaces for them, the RelayCommand class needs to have ' using System.Windows.Input; ' namespace, and then the _listener needs to have the ' using System.Net.Sockets; ' namespace. Start there, and see if it helps you progress with the program.
Hello I enjoyed your wonderful lecture! But how do I connect this chat app on another computer?
Would be nice to know what this ICommand interface is all about the code is some what confusing.
I have error ;
System.Windows.Markup.XamlParseException
"Adding a value to a collection of type 'System.Windows.Controls.ItemCollection' returned an exception.' Line number '35' and line position '18'.'
Inner Exception
InvalidOperationException: The operation is not valid when using ItemsSource. use ItemsControl.ItemsSource instead to access and modify items.
Can you help please.
How do you create a new project at all, much less a WPF app, in VS Code. I don't see these options.
Good question, you would have to use the CLI. I would highly recommend Visual Studio and not VS Code. :-)
@@_buffer Ah... I thought you were using VS Code. Thanks.
Nice job
Thank you! :-)
terrific!🥰
Thank you! :-)
Does is also work if i want to use ipv6?
I want the communication in UDP ,Is it easy to modify this to UDP?
Can you please tell me how did you open both two chat interfaces at one time in 27.47
Go into the bin folder, right click the solution > open folder in file explorer, and then it's in the bin folder
@@_buffer Or you can right click on the ChatClient > debug > Start New Instance this will start another client
i'm just stuck in that moment 8:05 if in video it at least showed error, in my situation it looks like it's not working at all because i have no error, no "connected" text (i decided to follow video a bit further cause i thought maybe program is working but it's not) it seems like a binding is not working, do i have to maybe install something on my visual or something else i simply have no clue how to make it work correctly
I have the exact same problem if you know how to fix it pls reply
Hey I want some help I am currently stuck at 20mins in this video. I tried recreation this wpf but im have a problem with the WriteString function. Error code CS7036
Not sure if anyone replied to you, but if they haven't, this is what I found.
If you are using .NET 4.x framework, you can do the following:
public void WriteMessage(string msg)
{
byte[] buff = BitConverter.GetBytes(msg.Length);
_ms.Write(buff, 0, buff.Length);
When iam copying the code from PacketBuilder like in 27:06 it shows an error and _ms.Write is red marked please help me i tried everything
This is probably because you are using .NET Framework instead of .NET core. in .NET framework .Write() has more parameters than in Core.
@@kevincuppett5341 Do you know how to fix it and if so could you please tell me?
@@marslmaoo It would involve switching from the framework to .net core. I just remade the project from scratch. I can imagine there is a way to switch though.
@@kevincuppett5341 ok thanks
@@marslmaoo If you are using .NET 4.x framework, you can do the following:
public void WriteMessage(string msg)
{
byte[] buff = BitConverter.GetBytes(msg.Length);
_ms.Write(buff, 0, buff.Length);
Great videos!
Thank you so much! :-)
Hi. Firstly. Thank you for the awesome tutorial. I love it!!
I have a question. So we are doing this as a group project and when we try to connect together but we cannot chat or the server does not display the user joined. We are using different machines. Please tell me how we can solve that issue. Thanks
you need to be in the same network and you also need to change the host address to the machine that host the application
nice
also second
Thank you! :-)
Can i use this code to make a chat app in winforms?
AWESOME
You! :-)
Cool video 🙌
What is this visual studio theme and how do i set this up?
Does this work over the internet?
Good question! Yes!
Hello, what happened to your multiplayer game ?
bro i love you
😌
This is not a messaging app. you can't use it without in your local network. or you can type there a regular computer ip address
You need to portforward the server and change the IP that the client connects to, it needs to connect to the server IP.
use some common sense brother
can you add more to that modern chat app you made 4 months ago
can you teach how to make a log in page and connect the login page to the modern UI video you made
two methods ahed.
if you create another window you can do new window().show() ; and it will create another window non blocking way and then you can do this.close(); and it will shut down the current window.
another option is to set both views as user control and bind it to content control and change it in code. change will happend after validation in code and if you ise hosting you may even inject iy as a navigation service
you god?
I am not :relieved:
Me wondering were did he gets an second Client
Is that only local?
No :-)
@@_buffer alright thanks so much!
Well, i know i need to learn this because deadline is looming but i am on 15th minute and my brain starts lagging
bruh, it's hard
Repository please?
It's available on Patreon :-)
source code???
On my Patreon in the description :-)
@@_buffer but can this source code could be free?
@@user_mmm No, just like everyone else you need to get it from Patreon.
@@_buffer wheres grid in visual studio 2022?
I get: The name "MainViewModel" does not exist in the namespace "clr-namespace:ChatClient.MVVM.ViewModel" what did i get wrong here?
I was having this issue too, I had to exit Visual Studio, and then open the project up again, and then build it.