How to Send and Receive UDP packets (in C)

  Рет қаралды 6,129

Jacob Sorber

Jacob Sorber

Күн бұрын

Пікірлер: 23
@Mronmovies
@Mronmovies 2 ай бұрын
Nice vid! A raw sockets video would be super! Also, it would be awesome to do a deep dive into the network stack, perhaps sk_buff?
@rico_1617
@rico_1617 Ай бұрын
Legend, literally posted this the day my networking course starts and there's an assignment with UDP lol
@mehregankbi
@mehregankbi Ай бұрын
Would love a video about unix and raw sockets.
@Barakatic
@Barakatic 2 ай бұрын
Very nice repeating so keep formula solid in your mind with time .
@BLSrr
@BLSrr 2 ай бұрын
Testing can also be done with socat or nc, both sending and receiving.
@Albert-yd1wh
@Albert-yd1wh 2 ай бұрын
I think it is useful to include continuous receiving packets in the tutorial. Because it is used more often than receiving a single packet.
@esrx7a
@esrx7a 2 ай бұрын
Super, is TCP coming up?
@JacobSorber
@JacobSorber 2 ай бұрын
I have a few stream socket examples that use TCP. Or are you hoping for a deep dive into the details of TCP?
@esrx7a
@esrx7a 2 ай бұрын
@@JacobSorber TCP demystified
@ahmadshami5847
@ahmadshami5847 2 ай бұрын
Cool video, but I've been always curious about the different ways to handle data coming through the network when it is larger than the defined the buffer. I do have an idea about maybe using fgets whith stdin for example to handle undefined data size but idk if it's the same case with data coming through a network socket.
@gunar3939
@gunar3939 Ай бұрын
Need socket timeout also other method to remove blocking functionality
@LarryEvilsizer
@LarryEvilsizer 2 ай бұрын
Thanks for your videos. My current main project is a network simulator so I'm generally interested in socket examples. I'm wondering what happened to the datagram sent around 11:10? It wasn't received by the receiver program.
@CosmicCoder
@CosmicCoder 2 ай бұрын
I was wondering the same thing. Perhaps they were on different instances of virtual machines?
@Gr4cer
@Gr4cer 2 ай бұрын
That's the beauty of UDP, it's "fire-and-forget". So you can just blast UDP pakets into the void, if theres no one listening, the message is just discarded by any connected node. Even though, as a sender you'll never know if someone or anyone has received the UDP paket. While TCP is doing a lot of handshakes such like regular heartbeats to check if the peer is still alive and connected, an acknowledge for each sent packet, packet resend features etc. which cause some overhead but UDP does none of those things on UDP-Protocol level. Many Applications that use UDP do have some counter included in their procotol so the receiving application can notice if there was a packet dropped.
@CosmicCoder
@CosmicCoder 2 ай бұрын
​@Gr4cer Ah! If there is no "active" listener bound to the port, the datagram is just discarded.
@LarryEvilsizer
@LarryEvilsizer 2 ай бұрын
@@CosmicCoder Thank you very much for your response
@LarryEvilsizer
@LarryEvilsizer 2 ай бұрын
@@Gr4cer Thanks for your response and excellent explanation.
@MathematicsStudent
@MathematicsStudent 2 ай бұрын
I seem to remember reading somewhere that connect can still be called for datagram sockets and that it has the effect of setting the default address for sending on that socket. Is that true?
@JacobSorber
@JacobSorber 2 ай бұрын
It is, indeed. I personally don't love using connect with UDP sockets, because it seems (at least to me) to imply a connection (like you have with TCP) where there isn't one. Could confuse some people reading the code, but yes, it does work that way.
@adsfaedaer
@adsfaedaer 2 ай бұрын
++(wire shark)
@AaronMatlock
@AaronMatlock 2 ай бұрын
The check in this example needs to close the socket.
@ДаниилРябов-з7ь
@ДаниилРябов-з7ь 2 ай бұрын
when http on stm32
Can I use connect with UDP sockets?
4:16
Jacob Sorber
Рет қаралды 2,5 М.
Binary data exercise: how to tell if a file is a jpeg?
17:48
Jacob Sorber
Рет қаралды 14 М.
Elza love to eat chiken🍗⚡ #dog #pets
00:17
ElzaDog
Рет қаралды 17 МЛН
Это было очень близко...
00:10
Аришнев
Рет қаралды 7 МЛН
When u fight over the armrest
00:41
Adam W
Рет қаралды 8 МЛН
Seja Gentil com os Pequenos Animais 😿
00:20
Los Wagners
Рет қаралды 88 МЛН
How does fork work with open files?
13:12
Jacob Sorber
Рет қаралды 10 М.
Student programmers, ChatGPT is not your friend
13:46
Jacob Sorber
Рет қаралды 12 М.
Why Function Pointers are Awesome
11:11
Jacob Beningo
Рет қаралды 8 М.
How do I access a single bit?
11:07
Jacob Sorber
Рет қаралды 22 М.
A better hash table (in C)
41:20
Jacob Sorber
Рет қаралды 30 М.
Advanced C: The UB and optimizations that trick good programmers.
1:12:34
Eskil Steenberg
Рет қаралды 173 М.
How to make memory read-only in your C programs.
12:57
Jacob Sorber
Рет қаралды 20 М.
A Jr Dev For Life?? | Prime Reacts
21:33
ThePrimeTime
Рет қаралды 317 М.
Elza love to eat chiken🍗⚡ #dog #pets
00:17
ElzaDog
Рет қаралды 17 МЛН