Тёмный

Program your own web server in C. (sockets) 

Jacob Sorber
Подписаться 165 тыс.
Просмотров 136 тыс.
50% 1

Опубликовано:

 

1 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 77   
@swarnavasamanta2628
@swarnavasamanta2628 3 года назад
Wow, this is exactly what i was looking for. I wanted to communicate with a backend database server using C. Everyone advised me to use python or javascript, but I really wanted to use C to learn the very basic of HTTP protocol and GET requests. Thank you very much.
@podi1555
@podi1555 4 года назад
Hello from Russia. Thank you so much, you explain very clearly and easily!
@JacobSorber
@JacobSorber 4 года назад
You're welcome. Glad it was helpful!
@mihirluthra7762
@mihirluthra7762 5 лет назад
I am really thankful that i found ur channel, really helped me alot. I love the way u just come to the point without wasting time on stupid little things. Thanks for the videos, best wishes.
@JacobSorber
@JacobSorber 5 лет назад
Glad I could help.
@gitaf8829
@gitaf8829 4 года назад
Hi Jacob, I'm from China. Just wanna say welcome to China! And I'm so appreciated what you're doing! It's very helpful!
@JacobSorber
@JacobSorber 3 года назад
You're welcome. Glad they're helpful.
@ensarmakas4904
@ensarmakas4904 Год назад
We working on IRC protocols. We will test our project with KVIrc. This video is good start i guess.
@hellelo.5840
@hellelo.5840 4 года назад
2 Years Later you will try to invent a templating language based on C then people will ask you to publish this language you will call it CTC, then people will use it as language instead of templating tool, then they force you to include all features of languages until it becomes fully object oriented language in its 7th version CTC 7.
@thuannguyen-thai4803
@thuannguyen-thai4803 5 лет назад
Hi Jacob, Thank you so much!!! The code you were presented, can it shared?
@donha475
@donha475 4 года назад
I've been looking for exactly this kind of channel. I'm a python dev but more and more I find myself wanting to dabble in some lower-level stuff... and I have a strange fascination with C even though C++ is probably easier to use for application development... I wonder if a lot of things could still be done in raw C given good enough libraries...
@JacobSorber
@JacobSorber 4 года назад
Everything CAN be done in raw C, given enough time and willpower. :) Welcome.
@godnyx117
@godnyx117 3 года назад
How's your journey going? I figured out, using a C++ compiler from the extra features but staying as close to C as possible is what I like to do ;)
@islandcave8738
@islandcave8738 3 года назад
A video on how to do secure sockets in C would be nice.
@mohammadhosseinzolfagharna8106
@mohammadhosseinzolfagharna8106 2 года назад
I have just recently found your channel, and i have to say its fantastic. Thanks a lot pal
@fabianpelopez
@fabianpelopez 4 года назад
Hi Jacob, wonderful tutorial :)
@115breno
@115breno Год назад
sir, thank you. i was having hella trouble finding someone that could explain sockets and servers in a eli5 way. you nailed it, ill check out your course when i can afford it
@edmondphillips9784
@edmondphillips9784 Год назад
Awesome vids, I was looking to learn C but I already know C++ so your channel ended up being the perfect gateway
@Dhakshith1189
@Dhakshith1189 3 года назад
Hey, I have a doubt. Why do you allocate arrays of length MAXLINE + 1, and then only set MAXLINE bytes to 0? And, why do you read only upto MAXLINE - 1 bytes into recvline?
@mamo100
@mamo100 2 года назад
Hello Thanks for this video. That was very helpful. Actually I have a question: What is the role of the "clien.c" here? Program will work even without client.c
@SpooningTreesap86
@SpooningTreesap86 3 года назад
5:57 Is there any way to guarantee sending all data contents before continuing? On the server side if I was sending data to my client (who is waiting like your example) is there a way I could make sure to finish sending all data before continuing in my server? My server gets hung up because I call write() to send one buffer and then send another (different) one after and do other stuff but I need to make sure the client gets the first message before continuing.
@ckim0324
@ckim0324 2 года назад
At 1:56, why not just calloc() as opposed to malloc() then bzero()? calloc would zero out the allocated memory.
@JacobSorber
@JacobSorber 2 года назад
Yes, that would work, too.
@marasorber8373
@marasorber8373 3 года назад
How could I render an html file that I pass to the server via http? Thanks for the videos by the way, no other content on this topic that's this good!
@JacobSorber
@JacobSorber 3 года назад
Hi Mara. Great name. 😀 I'm not 100% I'm understanding your question. Are you looking for advice on how to make your own browser-like program that actually draws the html on the screen?
@varudurock
@varudurock 6 месяцев назад
Thanks for the nice videos.
@sunilvasudevan01
@sunilvasudevan01 Год назад
it was a very useful session.. thank you
@alinaust2452
@alinaust2452 3 года назад
Hello, thank u so much. the best explanation ever ;))
@尚子皓-l3r
@尚子皓-l3r 5 лет назад
Amazing tutorial!! Wandering if you could share the code, which would be very helpful!
@jugnu361
@jugnu361 2 года назад
I use the server inside my PLC SCADA HMI Connect to it to gather real time data....but i use UDP......
@andy0401ify
@andy0401ify 11 месяцев назад
This playlist is gold!
@rohitjoshi4341
@rohitjoshi4341 3 года назад
I hope you could come up with videos which could give knowledge about html request response in c/cpp using or without using libraries like libuv, cpprest, curl etc. I find my struggle a lot making a small request - response in c/cpp compare to script languages like js,python. Which makes me wonder can we really do the same request- response in c/cpp.
@sortof3337
@sortof3337 4 года назад
Hi, how do I send my image files to the server in MacOS, I used the senfile() for the linux but I couldn't make it work for MacOS.
@AlFredo-sx2yy
@AlFredo-sx2yy Год назад
hey, can you please comment on your opinion regarding the more "modern" api that contains functions such as getaddrinfo?
@antonnyberg2082
@antonnyberg2082 2 года назад
Does the client.c program even do anything in this example? Or is it the connection from localhost that acts as the client in this case? Do I need the client program for this to work I guess the question is.
@Dhakshith1189
@Dhakshith1189 3 года назад
Hey I'm so thankful for your tutorials! I just wanted to give you a suggestion; Its better to use sizeof servaddr instead of sizeof(servaddr) to emphasize that sizeof is not a function, and that it is an operator. You would have known this, but just saying, brackets are necessary when you use sizeof on a type name.
@amrtcpp6203
@amrtcpp6203 4 года назад
Thank you Jacob, really thanks,, so much
@JacobSorber
@JacobSorber 4 года назад
Welcome.
@Undefined-Shade
@Undefined-Shade 2 года назад
Too hard for me.. Thanks btw..
@ragnus78
@ragnus78 3 года назад
Way to actually skip DNT in explaining list of request headers! Don’t worry I don’t know that one either.
@JacobSorber
@JacobSorber 3 года назад
Not worried. DNT = Do Not Track. Now you do. Sorry I missed that one.
@directx872
@directx872 4 года назад
There is something i never clearly understood. Aren't filedescriptors supposed to be unidirectional? like you have 1 to read and 1 to write to? why do we have only 1 to talk to the client here
@JacobSorber
@JacobSorber 4 года назад
pipes are unidirectional. Check out the man page for "open" and "fopen". You can open file descriptors for reading and writing.
@laibamustafa108
@laibamustafa108 3 года назад
I have a read() call and then a write() call in my while loop and write is executing before read, how can I make sure read completes first
@JacobSorber
@JacobSorber 3 года назад
I suspect something else is happening. The read and write calls should execute in the order that you call them. It's possible that the read is returning an error, or no data. Not sure. I would step through it in a debugger and look at what read() returns.
@wirelesskiller9686
@wirelesskiller9686 5 лет назад
Some of the things just went above my tiny homo sepien brain ... I'm not developed enough to grasp all of it ..no worrys gonna get there soon ..😩😬
@bonbonpony
@bonbonpony 5 лет назад
00:03 Oh, so can you speak Chinese too? :> 你会说话汉语吗? BTW I really like your tutorials. You don't waste any time, they are straight to the point :)
@JacobSorber
@JacobSorber 5 лет назад
Sadly, I don't. Maybe Chinese will be my next language. I'm glad you're enjoying the channel.
@krystof7059
@krystof7059 3 года назад
any tutorials how to make it working so i dont have to be on same pc and network? want to make server from my rpi 4 :)
@iuppiterzeus9663
@iuppiterzeus9663 3 года назад
basically you just have to deploy the server program on the hardware you want. when accessing it, you need the ip address of the pi. if you want to access it from "the outside" internet, you have to configure port forwarding in your router
@francojohnc
@francojohnc 4 года назад
I build a vpn
@revealingfacts4all
@revealingfacts4all 5 лет назад
nice video, you should expand this to cover epoll
@JacobSorber
@JacobSorber 5 лет назад
Thanks. Yes, definitely. There are a lot of ways to build on this one. epoll would definitely a good one.
@anisulfatma8943
@anisulfatma8943 4 года назад
Is it just me or did anyone else get annoyed by how the code in 1:05 looks like?
@iuppiterzeus9663
@iuppiterzeus9663 3 года назад
why that ?
@oscarmrad556
@oscarmrad556 Год назад
Hey man just found out about your channel and i think it will change my searching for answer life. Pretty clear explanation and covering all sorts of topics. I really like your color theme on Vscode, do you mind telling me which one it is. Thank you so much.
@JacobSorber
@JacobSorber Год назад
Welcome. Thanks for being here. As for VS Code, I think I'm just using the default dark theme.
@oscarmrad556
@oscarmrad556 Год назад
@@JacobSorber Thank you man, I have tried the default dark theme and it does not seem to be this one you are using. Can you please check on your vs code which one is it exactly because i really fell in love with that theme. The color matching is amazing. I have searched all themes but can't find yours. I would really appreciate it. Have a good day!
@yololololo9081
@yololololo9081 Год назад
what if i wanna expose my server to the public internet
@tealio3813
@tealio3813 2 года назад
very nice,tks
@jondabomb2184
@jondabomb2184 5 лет назад
I know it's been over a month so I 'm not sure I will get a reply but when I do localhost:21898 (the port i chose) it says localhost refused to connect. Do you know of any reason why any chance?
@JacobSorber
@JacobSorber 5 лет назад
Check your machine's networking/firewall settings. It's really common for operating systems to not allow connections to some ports, but usually just the low-numbered ports (like 80). So, this is a bit surprising. That would be my first guess, though. Alternatively, you could have another program using that port. Of course, it's really hard to say without more information and without messing around on your system.
@jondabomb2184
@jondabomb2184 5 лет назад
@@JacobSorber yeah, it's pretty odd it does not work with any port number i choose. I will try to do some more research to see how I can fix it, thank you though!
@MovieFilmHighlights
@MovieFilmHighlights 3 года назад
"Helloooooo"
@alexcaesar5377
@alexcaesar5377 3 года назад
what is your editor name?
@iuppiterzeus9663
@iuppiterzeus9663 3 года назад
atom
@kathiravankathir3089
@kathiravankathir3089 5 лет назад
its really cool
@javalex561
@javalex561 2 года назад
This is for Linux right?
@NordicFrog
@NordicFrog 2 года назад
Anything that supports unix sockets. So Linux, MacOS and all the BSDs.
@08-harshpathak36
@08-harshpathak36 3 года назад
Code editor?
@JacobSorber
@JacobSorber 3 года назад
I'm using VS Code these days. Used to use Atom.
@csbnikhil
@csbnikhil 4 года назад
```c #define IF_ERR(ARG) (if (ARG < 0) { perror(#ARG); exit(EXIT_FAILURE); })``` would be a useful macro. Edit: I want YT to introduce monospace fonts in the comments to add code snippets like this.
@JacobSorber
@JacobSorber 4 года назад
Indeed.
@JYSERroshanseeam
@JYSERroshanseeam 4 года назад
Very helpful!!!
@JacobSorber
@JacobSorber 3 года назад
Thanks. I'm glad it helped.
@everythingbutreversed2390
@everythingbutreversed2390 5 лет назад
My videoa are dope
@TheZerosteel
@TheZerosteel Год назад
Video start at 0:17 yourwelcome :3
Далее
НОВАЯ "БУХАНКА" 2024. ФИНАЛ
1:39:04
Просмотров 173 тыс.
ХОККЕЙНАЯ КЛЮШКА ИЗ БУДУЩЕГО?
00:29
Coding a Web Server in 25 Lines - Computerphile
17:49
Просмотров 338 тыс.
The Linux socket API explained
15:21
Просмотров 36 тыс.
How to make memory read-only in your C programs.
12:57
Web Server Concepts and Examples
19:40
Просмотров 249 тыс.
Sockets and Pipes Look Like Files (Unix/fdopen)
12:45
Easy Networking in C (libcurl)
14:12
Просмотров 65 тыс.
НОВАЯ "БУХАНКА" 2024. ФИНАЛ
1:39:04
Просмотров 173 тыс.