Mô tả

Welcome to this tutorial on UDP socket programming! This guide will explore the fundamentals of User Datagram Protocol (UDP) socket programming. Whether you are a beginner or an experienced programmer, this tutorial will provide you with a comprehensive understanding of UDP socket programming and how to use it to create efficient network applications. So, let's get started!

UDP, or User Datagram Protocol, is a layer-4 protocol in the OSI model. It is part of the transport layer along with TCP (Transmission Control Protocol). UDP is a connectionless protocol that provides a simple way to send packets of data without the need for a connection. It is often used for applications where speed is more important than reliability, such as video streaming or online gaming. While UDP does not provide any error-checking or retransmission of lost packets, it is still an important part of the OSI model and plays a vital role in many network applications.

This course teaches C# .Net socket programming with UDP sockets in a hands-on and easy fashion. It is a carefully planned and crafted online course that takes the student by the hand and teaches them how to create quality distributed network applications using C# .Net step by step.


In socket programming, connection-less sockets, which include UDP sockets, are often used for applications that require fast and efficient communication. Unlike connection-oriented sockets, which establish a dedicated connection between two endpoints before any data is transmitted, connection-less sockets send data packets to the intended recipient without any prior setup. This makes them ideal for applications prioritizing speed over reliability, such as real-time video streaming or online gaming. However, because there is no guarantee that the packets will arrive in the correct order or even arrive at all, developers must take extra precautions to ensure the accuracy and completeness of their data.


The first sections of this course cover the basics of computer networking and UDP socket programming in CSharp dot Net necessary for network and socket programming.


The following two sections will teach how to send and receive UDP broadcast in a command prompt C# .Net application using synchronous sockets with method calls such as Socket.Send and Socket.Receive. You will also learn how to convert between string and byte data types.

Once you're familiar with distributed network applications, the course takes you toward asynchronous socket programming. You will also learn about callback methods and how you can implement callbacks in C# .Net. I will also show you the publisher-subscriber model, AKA pub/sub model. We will implement the pub/sub model in our library project and the client/server applications using the library as well. We'll create event handlers and delegates and raise events as well.

We will use an Object Oriented approach for this course, following the principles of OOP. The next section will implement a publisher/subscriber model in C# .Net to bridge the gap between the API solution classes and the WinForms-based front end.

Next, you will learn JSON (JavaScript Object Notation) and how to add JSON functionality to your C# applications with Newtonsoft JSON .Net. Finally, we'll start implementing an application-level communication protocol in this section.

In the next section, you'll learn how to transmit binary data over a UDP socket in C# .Net. Then, for example, I will show you how to transfer png image files between multiple clients of your applications through the server. Again, the JSON-based protocol implemented in the previous section will play a key role here.

After watching this short C tutorial course, you can write your own distributed applications that communicate through the network, either WiFi or Ethernet. You will have the foundation knowledge needed to create C# .Net-based applications for IoT, computer telephony, VoIP, online gaming(e.g., Unity), and more.

This course also shows you how to use String Interpolation, a C# 6 feature. You'll also learn how to debug network applications in Visual Studio and write code faster.

You don't need to learn C to work on this course.[Related: Socket Java, python socket UDP]


Pros and Cons of UDP

UDP (User Datagram Protocol) is a simple and fast network protocol that is commonly used for real-time applications such as video conferencing, online gaming, and streaming multimedia content. However, it also has some drawbacks that should be considered.


Pros:

- Speed: UDP is faster than TCP because it doesn't have the overhead of error checking and retransmission of lost packets.

- Low latency: UDP is a connectionless protocol, which means that it doesn't establish a dedicated connection before transmitting data. This results in lower latency and faster response times.

- Simplicity: UDP is a simple protocol that is easy to implement and maintain.


Cons:

- Unreliable: UDP is an unreliable protocol because it doesn't guarantee the delivery of packets. This means that some packets may be lost or arrive out of order, which can affect the quality of the application.

- Security: UDP doesn't provide any built-in security features, which means that it is vulnerable to attacks such as packet spoofing and tampering.

- Congestion: UDP doesn't have any congestion control mechanisms, which means that it could potentially overload a network with too much traffic.


Bạn sẽ học được gì

UDP socket programming in C# .Net, synchronous and aynchronous

Foundations of distributed chat/IoT applications, communication components of multiplayer games, VoIP applications in C# .Net

Using Newtonsoft JSON in client server socket based applications

Yêu cầu

  • Visual Studio 2017
  • C# .Net
  • Programming

Nội dung khoá học

8 sections

Essential Networking Theory

4 lectures
Socket Programming in C#: Host in computer network
01:02
Socket Programming in C#: IP Address in computer network
01:27
Socket Programming in C#: Port Numbers in a computer network
02:24
Socket Programming in C#: Fundamentals of User Datagram Protocol
05:20

Introduction to UDP Socket Programming in C# .Net

4 lectures
Essentials of a Windows application in Visual Studio that uses UDP in C# .Net
01:49
Socket Programming: Sending a broadcast over UDP in C# .Net
04:24
Socket Programming: Receiving data broadcast over UDP in C# .Net
05:37
Socket Programming Demo: Sending & receiving a broadcast on UDP sockets in C#
01:57

Handling Byte Data and Working with Remote Endpoints.

6 lectures
Socket Programming: Converting string to byte in broadcast sender in C# .Net
03:19
Socket Programming: Converting byte to string in broadcast receiver in C#.Net
03:27
Socket Programming: Finding the remote EndPoint after receiving data in C#.Net
03:39
Socket Programming Demo: Finding the remote EndPoint after receiving data in C#
01:18
Socket Programming: Echo data back to sender in C# .Net
06:24
Socket Programming Demo: Echo data back to a peer in C# .Net
01:48

Asynchronous UDP Socket Programming in C# .Net

10 lectures
What is asynchronous and what does it look like when used for data communication
03:11
UDP chat application introductiom and Visual Studio project setup in VS/C#
05:14
What are callback methods in C# .Net
05:23
Receiving data asynchronously on server side - socket programming in C# .Net
11:01
Filling details of ReceiveCompletedCallback method in C# .Net Socket Programming
02:56
Demo: Receiving data async in socket programming with C# .Net
04:15
Send a network data broadcast asynchronously - socket programming in C# .Net
05:10
Send a network data broadcast asynchronously P2 - socket programming in C# .Net
04:23
Demo: Send Broadcast Async - UDP socket programming in C# .Net
04:23
Section Summary - Asynchronous UDP socket programming in C# .Net
02:30

Async UDP Socket Programming in C# .Net Part 2

7 lectures
Sending Back Confirmation Async - Socket Programming in C# .Net
05:17
Receiving Text Confirmation Async - Socket Programming in C# .Net
06:59
Demo: Receiving Text Confirmation Async - Socket Programming in C# .Net
02:38
Send Message to a Specific Server - Socket Programming in C# .Net
06:05
Receiving Message and Sending it to all Clients - Socket Programming in C# .Net
02:28
Correction - Fixing a bad if condition - Socket Programming in C# .Net
03:16
Demo: Sending Message to all Clients - Socket Programming in C# .Net
02:39

How to Raise and Handle Events in C# .Net

5 lectures
Section Introduction - Event Handlers in C# .Net
01:09
Publish Events from Source Classes of Socket Library in C# .Net
07:02
Implementing an event handler in a generalized class - Socket Programming in C#
02:47
Raising/handling an event from source classes - Socket Programming in C# .Net
02:32
Demo: Event Handlers - Socket Programming in C# .Net
08:44

Using JSON in network communication with C# .Net

8 lectures
Section Introduction - JavaScript Object Notation(JSON)
01:41
Add Newtsoft JSON.Net to your C#.Net Solution in Visual Studio with Nuget
04:13
Sending JSON Discover on Client Side - Socket Programming in C# .Net
04:55
Sending JSON Formatted Confirmation from the Server - Socket Programming in C#
03:15
Handling JSON Formatted Confirmation on Client - Socket Programming in C# .Net
02:35
Demo: Using JSON in Server DIscovery - Socket Programming in C# .Net
03:58
Sending a Message in JSON - Socket Programming in C# .Net
05:41
Section Summary - Using JSON on UDP Sockets - Socket Programming in C# .Net
01:14

Sending and Receiving Images In Chat Application

6 lectures
Section Introduction - Image & Binary Data Transfer - Socket Programming in C#
01:28
Read Image File from Disk to Transmit over UDP Sockets in C# .Net
05:07
Defining SendImage Method in C# .Net
03:16
Receiving a Bitmap Image on Client Side and Printing - Socket Programming in C#
09:32
Demo Sending and Receiving Images Over UDP Sockets in C# .Net
01:51
Section Summary - Transmitting Images - Socket Programming in C# .Net
01:37

Đánh giá của học viên

Chưa có đánh giá
Course Rating
5
0%
4
0%
3
0%
2
0%
1
0%

Bình luận khách hàng

Viết Bình Luận

Bạn đánh giá khoá học này thế nào?

image

Đăng ký get khoá học Udemy - Unica - Gitiho giá chỉ 50k!

Get khoá học giá rẻ ngay trước khi bị fix.