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.
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.
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.
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...
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
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?
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
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.
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?
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.
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.
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.
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
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.
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
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 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!
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?
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.
@@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!
```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.