C# Tutorial - SuperSimple TCP/IP Client Server | FoxLearn

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to foxlearn [Music] in this video i'll show you how to create a simple chat application using super simple tcp library [Music] first we will create a windows forms application project in.net core you can name a tcp client [Music] i'll change the target framework to.net 5 to use the new features of c 9. if you get the same error as me you can run dotnet restore command to fix the problem [Music] next rebuild your project then right click on your project and select manage nudget packages next search and install super simple tcp into your project [Music] simple tcp provides simple methods for creating your own tcp based sockets application enabling easy integration of connection management sending and receiving data it's a simple wrapper for tcp client and server in c sharp with ssl [Music] support next open your form designer then drag the text box button and label controls from the visual studio toolbox into your form designer you can design a simple ui that allows you to enter the server ip then click the connect button to connect to the tcp server we will use the send button to send messages to tcp server [Music] [Music] next right-click on your solution then create a new windows forms applications project in.net core you can name a tcp server [Music] you also need to install super simple tcp into the tcp server project [Music] you can also copy the tcp client form and then modify it to the tcp server form i will add a list box control to a tcp server form that allows me to get client connections [Music] you need to enter the server ip address in this case i use my computer as both the server and client so i will set it as local ip we will use the simple tcp server class to implement the tcp server form this class supports client connected client disconnected and data received events next add the click event handler to the start button which allows you to start the tcp server next add a formload event handler to the tcp server form that allows you to add client connected client disconnected and data received events [Music] [Music] if the client successfully connects to the server we will add the client ip into the list box control and vice versa we will remove the ip when the client loses connection [Music] next you need to check if the server has started and the message is not allowed to be empty before sending the message [Music] [Music] we will use the send method to send the messages to the client that we select from the list box control [Music] [Music] [Music] [Music] similarly we will use the simple tcp client class to implement the tcp client form this class supports server connected server disconnected and data received events [Music] as you can see the code i'm writing is slightly different from the tcp server form because i am using the new feature of c 9 to write the code [Music] [Music] so [Music] [Music] [Music] [Music] [Music] [Music] [Music] [Music] [Music] [Music] [Music] [Music] if you get the same error as me you can use the invoke method to solve the problem the invoke method which calls a delegate from the main thread to call the control [Music] the method invoker represents a delegate that can execute any method in managed code that is declared void and takes no parameters [Music] [Music] [Music] [Music] [Music] [Music] you will need to start your server first then the clients can connect to the tcp server through the ip address and port you specified we will use tcpip to transfer data between client and server tcp ip is a two layer program the higher layer transmission control protocol manages the assembling of a message or file into smaller packets that are transmitted over the internet and received by a tcp layer that reassembles the packets into the original message the lower layer internet protocol handles the address part of each packet so that it gets to the right destination each gateway computer on the network checks this address to see where to forward the message even though some packets from the same message are routed differently than others they'll be reassembled at the destination [Music] as you can see you can easily connect multiple clients to your tcp server [Music] thank you for watching this video and don't forget to subscribe to my channel
Info
Channel: Fox Learn
Views: 107,240
Rating: undefined out of 5
Keywords: foxlearn, c#, .net, .net core, c# chat application, c# tcp ip, c# tcp server, c# tcp client, c# tcp client server application, c# tcp, c# tutorial, c# chat program, c# simpletcp, c# supersimpletcp, supersimpletcp, c# tcp ip client server example, c# tcp ip socket programming, c# tcp ip example, tcp ip client server c#, c# network programming, tcp client chat c#, tcp chat client c#, simple tcp chat application c#, tcp ip c# code project, simpletcp c#, tcpclient, c# winforms
Id: QrdfegS3iDg
Channel Id: undefined
Length: 23min 10sec (1390 seconds)
Published: Thu Dec 03 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.